How to Delete All Named Ranges in VBA

When you’re copying spreadsheets around all over the place (particularly if you use the excellent advanced copy trick for isolating unique cells), you build up a gigantic store of named range. These are infurating.

Well, luckily I’ve developed a little VBA sub that wipes them all out:

Sub deleteNames()
Dim counter
Dim nameCount

nameCount = ActiveWorkbook.Names.count
counter = nameCount
Do While counter > 0
ActiveWorkbook.Names(counter).Delete
counter = counter - 1
Loop

End Sub

This made my friggen day.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.