Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Defined Names 1

Status
Not open for further replies.

gareth001

Technical User
Feb 4, 2003
43
GB
Hi all,

I'm wanting to delete all (about 60) the defined names within an excel workbook. I can delete the values of the defined names (end up with "=Sheet1!#REF!") with the below code, but not the name it's self even though I'm displaying it in the message box.

Code:
For Each n In ActiveWorkbook.Names
MsgBox n.Name
Range(n.Name).Delete
Next

Thanks for your help
 
you are deleting the RANGEs not the NAMEs

For Each n In ActiveWorkbook.Names
MsgBox n.Name
n.Delete
Next



Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top