Address Method

Applies To

Range Object.

Description

Returns the range reference, as a string in the language of the macro.

Syntax

object.Address(rowAbsolute, columnAbsolute, referenceStyle, external, relativeTo)

object

Required. Returns a reference to this range.

rowAbsolute

Optional. If True or omitted, the row part of the reference is returned as an absolute reference.

columnAbsolute

Optional. If True or omitted, the column part of the reference is returned as an absolute reference.

referenceStyle

Optional. If xlA1 or omitted, the method returns an A1-style reference. If xlR1C1, the method returns an R1C1-style reference.

external

Optional. If True, the method returns an external reference. If False, the method returns a local reference. The default is False.

relativeTo

Optional. If rowAbsolute and columnAbsolute are False, and referenceStyle is xlR1C1, you must include a starting point for the relative reference. This argument is a Range object that defines the starting point.

Remarks

If the reference contains more than one cell, rowAbsolute and columnAbsolute apply to all rows and columns.

See Also

AddressLocal Method, Offset Method.

Example

The following example displays four different address representations of the same cell address. The comments in the example are the addresses displayed in the message boxes.


Set mc = Worksheets("Sheet1").Cells(1, 1)
MsgBox mc.Address()                              ' $A$1
MsgBox mc.Address(rowAbsolute:=False)            ' $A1
MsgBox mc.Address(referenceStyle:=xlR1C1)        ' R1C1
MsgBox mc.Address(referenceStyle:=xlR1C1, _
    rowAbsolute:=False,     _
    columnAbsolute:=False,  _
    relativeTo:=Worksheets(1).Cells(3, 3))       ' R[-2]C[-2]