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 post, you’ll learn how to Find Blank cells in excel so that you can remove or delete the blank cells form...
In this article, you’ll learn what is a Gauge Chart in Microsoft Excel. Also, you will learn how to add...
Microsoft Excel provides a shortcut for the users to move columns in excel using two different ways – using Shift...