Share via


Name.RefersToRange Property

Excel Developer Reference

Returns the Range object referred to by a Name object. Read-only.

Syntax

expression.RefersToRange

expression   A variable that represents a Name object.

Remarks

If the Name object doesn't refer to a range (for example, if it refers to a constant or a formula), this property fails.

To change the range that a name refers to, use the RefersTo property.

Example

This example displays the number of rows and columns in the print area on the active worksheet.

Bb209088.vs_note(en-us,office.12).gif  Note
Ensure that you establish a print area on the active sheet of the current workbook.
Visual Basic for Applications
  p = Sheets(ActiveSheet.Name).Names("Print_Area").RefersToRange.Value
MsgBox "Print_Area: " & UBound(p, 1) & " rows, " & _
    UBound(p, 2) & " columns"

See Also