View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Listing or Changing all Defined Range Names (using VBA)

Hi Post Tenebras Lux,

Use the names Names collecyion. e.g.;

'=============
Public Sub Tester()
Dim NM As Name
Dim i As Long
Dim SH As Worksheet

Set SH = ActiveSheet

For Each NM In ThisWorkbook.Names
i = i + 1
With NM
SH.Cells(i, "A").Value = .Name
On Error Resume Next
SH.Cells(i, "B") = _
.RefersToRange.Address(0, 0, External:=True)
On Error GoTo 0
SH.Cells(i, "C").Value = .Value
End With
Next NM
End Sub
'<<=============


---
Regards,
Norman


"Post Tenebras Lux" wrote in
message ...
I have a lot of defined range names. I would like to be able to loop
through
them and either list them on a worksheet, with their range address in the
adjacent cell; or change the range name to something else based on a
specific
criteria.

I can handle all of the above except identifying the "collection" of range
names. Is it like worksheets collection with which I can use a For
Each...
loop?

This will help enormously with saving time, and permitting easy
documentation.

Thanks in advance