Range Names

G

Glenn

I need a simple way to delete all range names from a source file that I
process. I have no control over the source file. The file has a bajillion
defined names that I'd like to not even know what they are, just delete all.
Must I do them individually, or....
 
P

Peter T

Sub DelAllNames()
Dim nm As Name
For Each nm In ActiveWorkbook.Names
nm.Delete
Next
End Sub

Regards,
Peter T
 
B

Bob Phillips

Sub DeleteNames()
Dim nme As Name

For Each nme In ActiveWorkbook.Names
If nme.Name Like "*_FilterDatabase" Or _
nme.Name Like "*Print_Area" Or _
nme.Name Like "*Print_Titles" Or _
nme.Name Like "*wvu.*" Or _
nme.Name Like "*wrn.*" Or _
nme.Name Like "*!Criteria" Then
Else
nme.Delete
End If
Next nme

End Sub
 
R

Rick Rothstein

In addition to the other postings you got, you might want to consider that
some (if not all) of those names are used in worksheet formulas... if that
is the case and you delete them, you will break every one of those formulas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top