List out named ranges with VBA:
I have a file with a number of named ranges. I would like to have a routine that lists out all of the named ranges and display all of these names on a sheet.
I would like each row to be a unique name. Is there a way to list the name AND the range that the name refers to?
The macro for above problem is here:
Sub Rprt()
Dim nm As Name, n As Long, y As Range, z As Worksheet
Application.ScreenUpdating = False
Set z = ActiveSheet
n = 2
With z
.[a1:g65536].ClearContents
.[a1:D1] = [{"Name","Sheet Name","Starting Range","Ending Range"}]
For Each nm In ActiveWorkbook.Names
.Cells(n, 1) = nm.Name
.Cells(n, 2) = Range(nm).Parent.Name
.Cells(n, 3) = nm.RefersToRange.Address(False, False)
n = n + 1
Next nm
End With
Set y = z.Range("c2:c" & z.[c65536].End(xlUp).Row)
y.TextToColumns Destination:=z.[C2], DataType:=xlDelimited, _
OtherChar:=":", FieldInfo:=Array(Array(1, 1), Array(2, 1))
[a:d].EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub

ConversionConversion EmoticonEmoticon