VBA Offset Range or Cell

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on October 18, 2021

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:

Using the Offset Property With the Range Object

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:

Using the Offset Property to Select a Group of Cells in VBA

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! vba save as


Learn More!
vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples