Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Listing or Changing all Defined Range Names (using VBA)

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Listing or Changing all Defined Range Names (using VBA)


To list range names for a workbook, on a new worksheet in that workbook
select Insert Name Paste Paste List

Hope this helps,

Hutch

"Post Tenebras Lux" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Listing or Changing all Defined Range Names (using VBA)

Option Explicit
Dim rngname As Name
Dim i As Integer
Sub FindRangeName()
i = 1
For Each rngname In ActiveWorkbook.Names
Cells(i, 1).Value = rngname.Name
Cells(i, 2).Value = "'" & rngname.RefersTo
i = i + 1
Next rngname
End Sub

This code will list all of the Names Ranges in column A of sheet1 and all of
the corresponding ranges in column B.

Mike

"Post Tenebras Lux" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Listing or Changing all Defined Range Names (using VBA)

Thanks to all. Just what the doctor ordered.

Have a good w/e .

"Post Tenebras Lux" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Listing or Changing all Defined Range Names (using VBA)

You may want to get Jan Karel Pieterse's (with Charles Williams and Matthew
Henson) Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp

It'll make working with names much, much easier.

Post Tenebras Lux wrote:

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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Defined Names Lelethu Excel Worksheet Functions 2 March 18th 10 09:43 AM
Defined Range Names in formulas Darby Excel Discussion (Misc queries) 2 October 13th 09 04:41 PM
Listing Names in a spreadsheet MGaddict Excel Discussion (Misc queries) 1 January 29th 08 12:27 PM
Changing Multiple Defined Names At Once? Wuddus Excel Discussion (Misc queries) 3 September 26th 06 12:57 AM
Changing range names in VBA Rob Slagle[_2_] Excel Programming 3 September 13th 04 10:21 PM


All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"