Total Pageviews

Saturday, October 27, 2018

How to Select a Cell Relative to the Active Cell

















To select a cell that is three rows below and three columns to the left of the active cell, you can use the following example:

ActiveCell.Offset(3, -3).Select

To select a cell that is six rows above and six columns to the right of the active cell, you can use the following example:

ActiveCell.Offset(-6, 6).Select


Note An error will occur if you try to select a cell that is "off the worksheet." The first example shown above will return an error if the active cell is in columns A through C, since moving three columns to the left would take the active cell to an invalid cell address.

No comments: