Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the value of the cell to the right in VBA

Tags:

excel

vba

cell

What is the simplest code to get the value of the cell to the right of the current one?

Selection.Worksheet.Cells(Selection.Row, Selection.Column + 1).Value is a bit verbose.

like image 442
Dan Dascalescu Avatar asked Oct 20 '25 03:10

Dan Dascalescu


1 Answers

The shortest code seems to be:

ActiveCell.Offset(, 1).Value

Reference: ActiveCell, Offset. Both parameters to Offset are optional, and the RowOffset is omitted.

like image 117
Dan Dascalescu Avatar answered Oct 22 '25 22:10

Dan Dascalescu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!