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.

This entry was posted in programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s