RefersToLocal Property

Microsoft Office Web Components Object Model

RefersToLocal Property

       

Returns or sets a Variant representing the formula that the name refers to. The formula is in the language of the user, and it's in A1-style notation, beginning with an equals sign. Read/write.

expression.RefersToLocal

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, in the language of the user.

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.RefersToLocal

      Set rngCurrent = rngCurrent.Offset(1, 0)
   Next
End Sub