Name Manager does not open after progress wheel. Delete Names Macro produces Runtime Error 7.

Many of my files contain 11,990 named ranges in the name manager. All of them are #REF! and useless. Most of our files are based on templates that contain these named ranges, so all of the files I work in have thousands of named ranges that slow the program and slow down writing formulas (thanks to whatever jerk decided "sum", "sum1", "sum2", etc. were good names for ranges lol). When I try to open the name manager in the Formulas ribbon menu, the cursor wheel spins a while, then nothing happens. On rare occasions, the name manager does open, and I can delete them all, but I have not been able to figure out why that occasionally happens.

I tried writing a macro (below) and receive "runtime error 7: out of memory".

Sub DeleteNames()
     Dim nm as Name
     For Each nm In ActiveWorkbook.Names
          nm.Delete
     Next nm
End Sub

I can open the names in the browser version of excel, but I cannot select and delete more than one name at a time in that view - I can't delete 12k names one-by-one. Is there else I can try?

Using -> Microsoft® Excel® for Microsoft 365 MSO (Version 2501 Build 16.0.18429.20132) 64-bit

|

Could you share a test file to reproduce your issue? Make a copy of that file just leave name in your file. Then I can have a try on macro.

For sharing file, you may upload it to OneDrive or any other cloud drive and then post the link here. 

*Please make sure you have removed any sensitive or private information in the sample file before uploading. 

•Beware of Scammers posting fake Support Numbers here.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 13, 2025 Views 14 Applies to: