Over 400 hidden defined names leftover from 3rd-Party API...The names are almost identical...How can I remove w/o deleting my own defined name ranges?

Excelerate2014

New Member
Joined
Jun 25, 2014
Messages
41
Hello,

So Blooomberg excel add-in (which I no longer use) left a residual list of defined names on my excel files (all of them). They are named BLPH1 through BLPH400 (and counting). So when I copy worksheets I need to hold the enter key until 400+ "Yess" are confirmed. And if I change my mind. No matter, once you hit copy worksheet there is no turning back. The dialog box will not go away.

I use named ranges. All of the defined names and named ranges listed in Name manager are mine (and there are a bunch...some 100+ dynamic name ranges) so its impractical to use the VBA script that deletes all named ranges.

I am not very good with VBA, but I must imagine that given all of the hidden names are basically the same name just a different number that there is a simple way to use VBA to delete just those names with "BLPH1" to "BLPH400"?

Excel 2013

Thanks,
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Would this work for you?
Code:
Dim oneName As Name

For Each oneName In ThisWorkbook.Names
    If Not oneName.Visible Then
        oneName.Delete
    End If
Next oneName
 
Upvote 0
Thanks Mike. I am very very green when it comes to VBA. Just figuring out how to write the script to turn on Manual calc with iterations at start-up was a monumental event for me. Would you mind adding a bit more direction? Am I writing each word of that cose exactly as is? Do I use a basic module? Do i do this over 400 times? ((I assume not but just asking what is this code actually doing?) Appreciate any help.
 
Upvote 0
Apparently Excel uses hidden names for some behind the scenes uses. Try running this sub. Just copy paste it into a normal module and run it.

Code:
Sub test()
Dim oneName As Name

MsgBox "There are now " & ThisWorkbook.Names.Count & " names in the workbook."

On Error Resume Next
    For Each oneName In ThisWorkbook.Names
        If Not oneName.Visible Then
            oneName.Delete
        End If
    Next oneName
On Error GoTo 0

MsgBox "There are now " & ThisWorkbook.Names.Count & " names in the workbook."
End Sub
 
Upvote 0
yikes... That one definitely ran. Message box popped up that says "There are now 6,532 names in the workbook" does that sound right? Thanks
 
Upvote 0
I count 86 names in the Name Manager (all mine). I guess there are 4 that will always remain hidden. No more pop-ups on copy. Thanks again.
 
Upvote 0
Maybe too late, but a variation. Deleting the names that start with "BLPH"

I've referred to the activeworkbook.names

Thinking you could put the code in your personal macros & run it easily on many workbooks. Or with more complexity make the code auto-run every time a file opens.
 
Upvote 0

Forum statistics

Threads
1,223,719
Messages
6,174,089
Members
452,542
Latest member
Bricklin

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