Search code examples
excelcellvba

Get the value of the cell to the right in VBA


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.


Solution

  • The shortest code seems to be:

    ActiveCell.Offset(, 1).Value
    

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