How to use Offset Range or Cell in Excel VBA?

In this post, let’s have a look at an example of how to use offset in your excel spreadsheet using Excel VBA.

What is Offset Property in Excel VBA?

The Offset property in Excel VBA is used to programatically return a cell or range which is relative to a specified cell.

Syntax

Range.Offset(RowOffset, ColumnOffset)

Range defines the cell or range of cells. RowOffset and ColumnOffset acceprt integers. When it is a positive integer, the offset moves towards the bottom and right. When a negative value is provided, its moves up and left.

How to use Offset with Range Object in Excel VBA?

Below is a code snippet demonstrating how to use Range object and Offset property to select the cell C2 when your specfied cell is B1.

Range("B1").Offset(1, 1).Select
How to use Offset Range or Cell in Excel VBA?

How to use Offset with Cells Object in Excel VBA?

You can use the below code snippet that demonstrates how to use the Cells object and the Offset property to select the cell B3 when the input cell is C4.

Cells(4, 4).Offset(-1, -1).Select

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this article, you will learn about the SKEW.P function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the SKEW function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the RANK.EQ function, the formula syntax and usage of the function in Microsoft...
  • Excel
  • November 23, 2021