Using the Offset Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

You can use the Offset property to return a Range object with the same dimensions as a specified Range object but offset from the specified range. For example, you could use the Offset property to create a new Range object adjacent to the active cell to contain calculated values based on the active cell.

The Offset property is useful in circumstances where you do not know the specific address of the cells you must work with, but you do know where the cell is located in relation to other cells you must work with. For example, you might have a command bar button in your custom application that fills the active cell with the average of the values in the two cells immediately to the left of the active cell:

ActiveCell.Value = (ActiveCell.Offset(0, -2) + ActiveCell.Offset(0, -1)/2)

See Also

Working with Microsoft Excel Objects | Understanding the Range Object | The Range Property | Using the CurrentRegion and UsedRange Properties | The ActiveCell and Selection Properties | Using the Cells Property