+ Reply to Thread
Results 1 to 5 of 5

cleaning up obsolate names using For Each... In ... Next

  1. #1
    Registered User
    Join Date
    01-03-2012
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    29

    cleaning up obsolate names using For Each... In ... Next

    I would greatly appreciate any help as I am totally stuck.

    When I delete a Range (i.e. column) with named cells the names are not deleted.
    I am trying to write a code to delete leftovers. So far I have:

    Please Login or Register  to view this content.
    I use the Immediate window to check if I get any hits and "Names manager" to confirm that there should be.

    I have no idea what is wrong, as following works:
    Please Login or Register  to view this content.
    as well as:
    Please Login or Register  to view this content.
    Last edited by Gzdnkh; 02-08-2012 at 09:02 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: cleaning up obsolate names using For Each... In ... Next

    try this,
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    01-03-2012
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: cleaning up obsolate names using For Each... In ... Next

    It works! Thank you very much.

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

    Re: cleaning up obsolate names using For Each... In ... Next

    Do not use 'reserved' names for variable names.
    You didn't check a property of a 'name'.

    You could have been successful with:

    Please Login or Register  to view this content.



  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: cleaning up obsolate names using For Each... In ... Next

    Please note that snb's suggestion will also delete non range referenced names, which may not be something you want to happen.

    If you use a Name to store some static text then it too will be deleted. For example.

    Name_6: ="Hello World"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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