Range Offsets, Unions, and Intersections

Use the Offset property to obtain a range that is offset by a specific amount with respect to another range. This is similar to the offset obtained using the Range.Range property, as discussed previously, but it has the advantage of using a numerical offset rather than an alphanumeric column/row designator. The syntax is

SomeRange.Offset(RowOffset, ColumnOffset)

The two arguments specify the number of rows or columns to offset by. Positive values are down and right, negative values are up and left. If either argument is omitted, the default value of 0 is used. This example activates the cell that is three columns to the right of the current active cell on the worksheet SalesData:

 Worksheets("SalesData").Activate ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.