VBA Offset Range or Cell
Written by
Reviewed by
In this Article
The Offset Property is used to return a cell or a range, that is relative to a specified input cell or range.
Using Offset with the Range Object
You could use the following code with the Range object and the Offset property to select cell B2, if cell A1 is the input range:
Range("A1").Offset(1, 1).Select
The result is:
Notice the syntax:
Range.Offset(RowOffset, ColumnOffset)
Positive integers tells Offset to move down and to the right. Negative integers move up and to the left.
The Offset property always starts counting from the top left cell of the input cell or range.
Using Offset with the Cells Object
You could use the following code with the Cells object and the Offset property to select cell C3 if cell D4 is the input range:
Cells(4, 4).Offset(-1, -1).Select
Selecting a Group of Cells
You can also select a group of cells using the Offset property. The following code will select the range which is 7 rows below and 3 columns to the right of input Range(“A1:A5”):
Range("A1:A5").Offset(7, 3).Select
Range(“D8:D12”) is selected:
VBA Coding Made Easy
Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!Learn More!