Defined Names Issue

CarlCarlos

New Member
Joined
Jan 12, 2011
Messages
31
All,

Please help !

I have finally found out why some of my spreadsheets become huge sizes. It has something to do with "Phantom Links", I have no idea how these link to my spreadsheet and I am unable to break them, this results in 1000's of Defined Names (Insert / Names / Defined Names).

How can i delete ALL of these quickly as doing them one by one will take FOREVER !!!

I have looked at previous posts and none of those Marcros would work, for some reason it would always fail at the 'Delete' line
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try

Code:
Sub DeleteAllNames()
Dim i As Long
For i = ActiveWorkbook.Names.Count To 1 Step -1
      Range(ActiveWorkbook.Names(i).Name).Name.Delete
Next
End Sub
 
Upvote 0
Thank you for such a quick reply, Just put it through VBA (insert modual) and has the following error:

run time error 1004
Method of 'Range' of object '_Global' failed

any ideas?
 
Upvote 0
Defined names and links are a couple different issues...

To handle named ranges in Excel, I use the free Name Manager by JKP (Jan Karel Pieterse). Just google that and you'll find it immediately. It puts Excel's name handling on steroids.

I've also used the FindLink addin by Bill Manville for trying to deal with link issues.

A couple utilities you can try. Hope it helps.

GTS
 
Upvote 0
Darn,

Just had a look at the link and it is point two causing all the issues... I have 1000's of pages of names in there (probably caused by this work file being rolled over time and time again)
I can only assume that it has failed because some of the Defined Names may be causing an issue with the Macro?

Because i am at work, i am unable to download any addins :(
 
Upvote 0
Darn,

Because i am at work, i am unable to download any addins :(

I hear you. Sigh. Our IT dept is quite strict as well. They don't allow any 'outside' programs. So far, they haven't bothered me about a few Excel Addins that I have. Fingers crossed that it stays that way.

btw, I've also used ASAP Utilities in the past (briefly). IIRC, it also has a mass name deleting feature.

I have had to fix stuff like this at home when one doesn't have the tools they need at work.

Good luck.
 
Upvote 0
Then try this

Code:
Sub DeleteBadNames()
Dim nm As Excel.Name
Dim vTest As Variant
For Each nm In ActiveWorkbook.Names
    vTest = Empty
    On Error Resume Next
    vTest = Application.Evaluate(nm.RefersTo)
    On Error GoTo 0
    If TypeName(vTest) = "Error" Then nm.Delete
Next nm
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,682
Messages
6,126,195
Members
449,298
Latest member
Jest

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