Вывести все имена, в т.ч. именованные формулы в отдельный список, в виде имени и адреса — Visual Basic(Бейсик)

Вариант
code: #vba
For Each iName In ThisWorkbook.Names
   Cells(iName.Index, 1).Value = iName.Name
   Cells(iName.Index, 2).Value = "'" & iName.RefersToLocal
Next
Вариант
code: #vba
With ThisWorkbook.Names
   For iCount = 1 To .Count
       Cells(iCount, 1).Value = .Item(iCount).Name
       Cells(iCount, 2).Value = "'" & .Item(iCount).RefersToLocal
   Next
End With
Bonus
code: #vba
For Each iName In ThisWorkbook.Names
    With iName
         iIndex = .Index + 1
         Cells(iIndex, 1).Value = .Name
         Cells(iIndex, 2).Value = .Parent.Name
         Cells(iIndex, 3).Value = TypeName(.Parent)
         Cells(iIndex, 4).Value = "'" & .RefersTo
         Cells(iIndex, 5).Value = "'" & .RefersToLocal
         Cells(iIndex, 6).Value = .Visible
    End With
Next
With Range(Cells(1, 1), Cells(1, 6)) 'Range("A1:F1")
     .Value = Array("Name", "Parent", "NameLevel", _
     "RefersTo", "RefersToLocal", "Visible")
     .Font.Bold = True
     .EntireColumn.AutoFit
End With

Leave a Comment