+ Reply to Thread
Results 1 to 15 of 15

Out of Memory when trying to delete named ranges

  1. #1
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Out of Memory when trying to delete named ranges

    Hi,

    I have a workbook that contains likely thousands of old named ranges that are not used anymore. There are so many named ranges that I can't even open the Name Manager. The named ranges I'm trying to delete have a similar syntax. The following is the code I've written for it:

    Please Login or Register  to view this content.
    I believe this code should work, however whenever I try to run it I get the Out of Memory Error 7 error.

    Any one have any ideas how I can adjust this code to remove these similar named ranging without running out of memory?

    Thanks!!

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,018

    Re: Out of Memory when trying to delete named ranges

    That is not a valid name, so I don't see the point of the code? Did you mean to use 'Like' rather than '='?

  3. #3
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Out of Memory when trying to delete named ranges

    Hi Rorya,

    Yes, I tried using a wildcard rather than using Like. Any suggestions to get around the memory issue?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,018

    Re: Out of Memory when trying to delete named ranges

    Do you get the same issue with this code:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Out of Memory when trying to delete named ranges

    Hi Rorya. Yes, I get the same out of memory error 7 message.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,018

    Re: Out of Memory when trying to delete named ranges

    You may be SOL with VBA then. Does this work:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Out of Memory when trying to delete named ranges

    Hi Rorya,

    Thanks for the code. I tried and ran it. I didn't get the error message but it doesn't appear that anything happened. None of the named ranges were removed.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,018

    Re: Out of Memory when trying to delete named ranges

    It occurs to me that a name cannot begin with anything other than an underscore or a letter, so what do the actual names look like - can you give a specific example?

  9. #9
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Out of Memory when trying to delete named ranges

    Yes you're correct. The names all begin as Y.00 and then 6 numbers behind that.

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,018

    Re: Out of Memory when trying to delete named ranges

    Then try:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Out of Memory when trying to delete named ranges

    Thanks. I actually tried that already. No errors this time, but it doesn't appear that anything happened either.

  12. #12
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,018

    Re: Out of Memory when trying to delete named ranges

    Did you have the correct workbook active when you ran it? If so, I suspect you may have to edit the XML of the file (assuming it's an XML based format rather than binary).

  13. #13
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Out of Memory when trying to delete named ranges

    Yes, the macro is being run in the same workbook that has the named ranges. What do you mean edit the XML of the file? I'm not familiar with that.

  14. #14
    Forum Contributor
    Join Date
    05-12-2018
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    266

    Re: Out of Memory when trying to delete named ranges

    try this:

    Please Login or Register  to view this content.

  15. #15
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,018

    Re: Out of Memory when trying to delete named ranges

    I mean you'd have to unzip the workbook (it's basically a compressed folder) and then edit the XML to remove the name definitions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to delete 2 named ranges
    By bevc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2016, 02:37 AM
  2. [SOLVED] Delete all Named Ranges in another workbook
    By tejay in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-15-2015, 03:43 AM
  3. Duplicate Named Ranges, how to specify which one to delete
    By treygriffin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-11-2013, 10:45 AM
  4. Delete named ranges from selection
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2012, 05:20 PM
  5. Named Ranges and Memory Usage
    By Rabk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2007, 07:36 PM
  6. delete a bunch of named ranges
    By Takeadoe in forum Excel General
    Replies: 2
    Last Post: 06-30-2006, 07:35 AM
  7. [SOLVED] How do I delete all named ranges in a sheet at one time?
    By L.Wall in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1