Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

Getting list of named ranges

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DZ - 10 Dec 2007 08:38 GMT
Hello

I want to get  A list of the ranges that i have named in a workbook that I
did not create. I named 2 ranges

But when I run the following code, I get the 2 ranges I named plus
additional names that I did not create and that don't appear in the define
names dialog.
These other names are as follows and I have no idea what they are or where
they came from but they are not listed in the Define Name dialog box.

'FT Claims'!_FilterDatabase
'PT Claims'!_FilterDatabase
'Midland Account'!_FilterDatabase

I want the code to only return the named ranges (which are the names listed
in the Define Name dialog)

Here is the code I used

Sub GetNamedRanges()
Dim nMames As Names
Dim nName As Name

For Each nName In Application.ThisWorkbook.Names
MsgBox nName.Name
Next nName

End Sub

Signature

DZ

Bob Phillips - 10 Dec 2007 09:15 GMT
Sub GetNamedRanges()
Dim nMames As Names
Dim nName As Name

   For Each nName In Application.ThisWorkbook.Names
       If Not nName.Name Like "*_FilterDatabase" And _
           Not nName.Name Like "*Print_Area" And _
           Not nName.Name Like "*Print_Titles" And _
           Not nName.Name Like "*wvu.*" And _
           Not nName.Name Like "*wrn.*" And _
           Not nName.Name Like "*!Criteria" And _
           Not nName.Name Like "*xlfn.*" Then
           MsgBox nName.Name
       End If
   Next nName

End Sub

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Hello
>
[quoted text clipped - 26 lines]
>
> End Sub
DZ - 10 Dec 2007 10:09 GMT
Thanks That did it.

Now I'm very curious. What are those other names that you filtered out. How
are they created. Where do they come from?

DZ
Bob Phillips - 10 Dec 2007 13:07 GMT
They are system generated names that are created when you use certain system
functionality.

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Thanks That did it.
>
[quoted text clipped - 3 lines]
>
> DZ
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.