RefersTo 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.
Returns or sets the formula that the name as defined refers to, in the language of the script and in A1-style notation, beginning with an equal sign. Read/write Variant.
expression.RefersTo
expression Required. An expression that returns a Name object.
Example
The following example creates a list of all the names in the active workbook, along with the formulas to which they refer.
Sub List_All_Names()
Dim nmCurrentName
Dim rngCurrent
Set rngCurrent = Spreadsheet1.ActiveSheet.Range("A1")
' Loop through all of the names in the active workbook.
For Each nmCurrentName In Spreadsheet1.ActiveWorkbook.Names
' Write the current name to the worksheet.
rngCurrent.Value = nmCurrentName.Name
' Write the definition of the current name to the worksheet.
rngCurrent.Offset(0, 1).Value = "'" & nmCurrentName.RefersTo
Set rngCurrent = rngCurrent.Offset(1, 0)
Next
End Sub