PDA

View Full Version : Solved: Deleting name ranges (xl '97)



phendrena
07-14-2009, 12:24 AM
Greetings,

I was wondering if there was a better way to delete named ranges using VBA. For example I have the following :-
ActiveWorkbook.Names("RangeName").Delete
Now this fine for 1 or 2 named ranges, but what if you have a quite a few?
Is it possible to delete a named range without actually naming the range or will i need to somehow get the names (and count them) and then loop through and delete them?

Thanks,

mdmackillop
07-14-2009, 12:46 AM
Sub DelNames()
Dim nm As Name
For Each nm In ActiveWorkbook.Names
nm.Delete
Next
End Sub

phendrena
07-14-2009, 12:51 AM
Brilliant!
Thank you so much!

:clap: