Name manager - how to select all and delete all names?

badass

New Member
Joined
Mar 13, 2015
Messages
12
Hello fellow excelers!

I just moved a worksheet from one workbook to another and all of the defined names have transferred over (thousands upon thousands of them with #REF errors everywhere), making it impossible to navigate to my actual defined names that I want to use...I tried Ctrl + A to select all but that did not work...is there any way to select all of the names at once and delete them all? This is a real headache (even by holding the Shift + Down arrow it takes forever)...Any ideas on how to go about this? Here's what it looks like...

Name%20manager_zpsr2dy7ire.jpg


Any help would be greatly appreciated!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I haven't used this in a long while and haven't tested it since last use, but you can give it a try.
Code:
Sub RemoveNamesWithRefErrors()
'Removes all names in the active workbook that have #REF! errors in the RefersTo

Dim nm As Name, WkBk As Workbook, ctr As Integer, sList As String, msg As String
ctr = 0
sList = ""
Set WkBk = ActiveWorkbook
On Error Resume Next
For Each nm In WkBk.Names
    If InStr(1, nm.RefersTo, "#REF!") > 0 Then
        sList = sList & Chr(10) & nm.Name  'Chr(10) inserts a carriage return
        ctr = ctr + 1
        nm.Delete
    End If
Next nm
msg = ctr & UCase(" names with errors were deleted")
msg = msg & sList
MsgBox msg
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top