MS Excel Training

Macro to Refer to Excel cells relative to other worksheet cells using offset

You can refer to Excel cells relative to other worksheet Excel cells using Excel macro. A common way to work with an Excel cell relative to another cell in Microsoft Excel is to use the Offset property. In the following example, the contents of the Excel worksheet cell that's in the same row and two columns to the right from the active cell on the active Excel worksheet is formatted as double-underlined. The total value is double underlined.

Macro code:

Sub UnderlineDouble()
ActiveCell.Offset(0, 2).Font.Underline = xlDouble
End Sub







Further resources
Excel Cell References. Relative and Absolute Cell References

Refer to Excel cells relative to other worksheet Excel cells using Excel macro