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

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 )

Facebook photo

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

Connecting to %s