Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with named constants in Define Name dialog box!!!!

I have created a utility that contains named constants used for data validation on a particular sheet. As an enhancement requirement from the users, they want to be able to copy another workbooks sheet(s) into the utility. While using some sample files provided from the users, I have encountered name constants are being copied into the utility.

There is a routine that I can write to eliminate unneeded name constants, while keeping the required ones?

How can I get a listing of the named constants listed in the Define Name dialog box and only those names (not the Refers To€¯) along with the associated index

Any assistance would be greatly appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with named constants in Define Name dialog box!!!!

In code, you can use:

Sub GetDefinedNames()

Dim n As Name

For Each n In ActiveWorkbook.Names
Debug.Print n.Name & " " & n.Index
Next

End Sub

Adapt to your needs.



--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with named constants in Define Name dialog box!!!!

Dim nm as Name, i as Long
i = 0
for each nm in Activeworkbook.Names
i = i + 1
msgbox "index: " & i & " name: " & nm.name
Next

However, if you are going to delete the names, you need to loop backward or
the indexes could change.

--
Regards,
Tom Ogilvy


"ilona" wrote in message
...
I have created a utility that contains named constants used for data

validation on a particular sheet. As an enhancement requirement from the
users, they want to be able to copy another workbook's sheet(s) into the
utility. While using some sample files provided from the users, I have
encountered name constants are being copied into the utility.

There is a routine that I can write to eliminate unneeded name constants,

while keeping the required ones?

How can I get a listing of the named constants listed in the Define Name

dialog box and only those names (not the Refers To") along with the
associated index?

Any assistance would be greatly appreciated



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with named constants in Define Name dialog box!!!!

Thanks kknie and Tom for you help. Your solutions worked.

Sub DeleteCopiedNames(
Dim NameConstant As Nam

For Each NameConstant In ActiveWorkbook.Name
If NameConstant.Visible The
Debug.Print NameConstan
' NameConstant.Delet
End I
Next NameConstan

End Su

When I run this code, all the names appear include workbook name. Can you please explain to me why? It was my understanding that the visible method would only show the names that appear visible in the dialog box.
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
How do I have a cell value define a dynamic named range? CellShocked Excel Worksheet Functions 15 October 26th 11 02:08 AM
Array Constants kittronald Excel Worksheet Functions 0 June 15th 11 12:04 AM
How to Define a named Formula at the Worksheet level? RPJ Excel Worksheet Functions 2 October 22nd 06 05:11 PM
Define a range based on another named range Basil Excel Worksheet Functions 2 February 21st 05 01:47 PM
constants Confused Excel Discussion (Misc queries) 3 December 2nd 04 05:05 PM


All times are GMT +1. The time now is 03:38 AM.

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

About Us

"It's about Microsoft Excel"