+ Reply to Thread
Results 1 to 12 of 12

range name cleaner out there? I have range names that cannot only be deleted by hand?!

  1. #1
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Exclamation range name cleaner out there? I have range names that cannot only be deleted by hand?!

    Hi,

    I work sometimes with files that with sheets copied from old excel files from japan and are loaded with Excel 4.0 macros and/or range names with invalid names and/or definitions. I would really like to delete them all by code because there are many of them.

    by hand is no problem, open the dialog and ONE BY ONE i can delete them .
    however if I instruct a macro to do the same error comes saying "error 1004, that name is invalid"
    I tried to make them visible, change the definition, but nothing works.
    and putting "ON ERROR REUME NEXT" leaves then as they are...

    I even thought of manipulating the names dialog by code, but aparently that is impossible...

    should I do it by sendkeys or something like that??

    I attach the file for your amusement --- whoever makes a code to delete all range names will win my eternal gratitude.
    I had to compress the file because otherwise it is more than 1MB ! (no content besides range names...!)



    kind regards


    Bernat
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    hi, reading my own words I gave it a shot with sendkeys -- and this is what I came up with
    it works, somehow, but while running excel is not very responding and I don't really know what is going on (which I don't like)

    if anyone has a better idea (or better implementation with SENDKEYS please let me know!


    Please Login or Register  to view this content.

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    I wouldn't bother.
    Copy the contents of the worksheets to a new workbook and save that as the file you want to work with.



  4. #4
    Forum Contributor
    Join Date
    06-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    Give this a try


    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    Thank you Thalassa,

    but the problem here is not to check which range names are valid or not, but the fact that invalid names cannot be eliminated the way you suggest.
    rm.delete results in the error I posted on top of this thread.

  6. #6
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    Hi snb,

    the reason why I bother is that the problem keeps coming once in a while, there are many sheets in each file, and manipulation with macros even to copy contents out result in excel crash... I think I need to solve the problem somehow

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    result in excel crash...
    That may be due to the same problem; try

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    I see that avoids the copy-paste part --- but then I'm affraid images will not get copied, am I right?

  9. #9
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    A friend told me of this script
    http://www.jkp-ads.com/downloadscrip...ameManager.zip

    seems to do the trick, even though I'm still fighting with the issue

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    Quote Originally Posted by bagullo View Post
    I see that avoids the copy-paste part --- but then I'm affraid images will not get copied, am I right?
    Right, but in that case you could also try:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    thank you again snb,

    but the problem is not in the formulas -- it's in the nameranges that get automatically copied when a sheet is copied
    all old macros and so on get copied even when they are not used in the sheet, it's very weird, and it's actually the origin of all this mess....

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: range name cleaner out there? I have range names that cannot only be deleted by hand?!

    I know, but when these named ranges are being used in a formula it messes up the copying process, hence the crashing of Excel.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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