View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
TomCat TomCat is offline
external usenet poster
 
Posts: 34
Default Deleting Multiple Names

Thanks for the reply, Per. I tried it and got an error on the n.Delete.

Sub RemoveNames()
For Each n In ActiveWorkbook.Names
n.Delete <------------error
Next
End Sub

"Per Jessen" wrote:

Hi

You can remove all names in the active workbook with this workbook.

Sub RemoveNames()
For Each n In ActiveWorkbook.Names
n.Delete
Next
End Sub

To inser the code:
Alt+F11 to open the VBA editor
Goto Insert Module
Copy the above code to the code sheet
Run the macro.

Hopes this helps.

---
Per

"TomCat" skrev i meddelelsen
...
I have acquired a spreadsheet that has been used for many different
applications by many people. Consequently, several hundred names have been
applied to cells and/or references to other spreadsheets. Each time I
creat a
copy of one of the worksheets, a dialogue box appears asking me if I want
to
keep or rename the name that has been applied to cells in the sheet. I
have
to either hit OK or rename all of them.

What I want to do is delete ALL of the names and start with a clean sheet
each time I copy it. It's very cumbersome deleting them one at a time in
the
INSERT - NAME - DEFINE box.

How can I perform a MASS Name Delete?

Thanks.........TC