+ Reply to Thread
Results 1 to 5 of 5

Macros stop working, supposed to find next empty cell in column and label...

  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2002 (10.6871.6870) SP3
    Posts
    3

    Macros stop working, supposed to find next empty cell in column and label...

    Hi Everyone, I hope this is the right area and format to post.

    Bascially, a company i started doing work for has excel files they use to keep statistic data in, and every time it opens it runs a couple macros that go to the bottom of a column and label the next empty cell as either NextWeek or NextMonth, and then creates a label for the previous 13 positions on every column like "A_Data" or "AB_Data" depending on which column. Finally, there are graphs with their own worksheet tabs at the bottom that update automatically with the data because they point their data to the labels "AB_Data" for the x-axis.

    HOWEVER, even though we use the same template for about 200 different files, about 1 in 15 goes awry and it just stops updating the labels, and I don't know enough about excel macros to figure out why they're breaking!? AAARgghh..

    Anyway, I'm going to include an example of a working one, and a non working one. In the non working one (example 1) it labels A473 as NextWeek but it's supposed to label A482 as such.

    Any and all help is super appreciated! I'm dying trying to just figure out what it is that triggers these to break, let alone figure out a fix, but I'm spread pretty thin and I'm just helping out in the area since no one else here has a clue.

    -E
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,613

    Re: Macros stop working, supposed to find next empty cell in column and label...

    What you are calling a "Label" is usually referred to as a "Named Range". It took me a while to figure out what you meant.

    In the workbook that is not working, columns Z:AL should be shifted one column to the right to AA:AM. This would line up with the same columns in the workbook that does work. If you shift the columns over by one, the named ranges seem to update properly. My guess is someone deleted a column to the left of AA and shifted everything to the left.

    One other item to note; within the SetRegions procedure (where the Named Ranges are updated), there is an error handler at the end called Process_Error:. The error handler only exits the procedure. While this is expedient, it doesn't tell the user there was a problem. So basically, it was "hiding" the error. Maybe change it to this so at least it shows a message that there is a problem should it happen again.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-06-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2002 (10.6871.6870) SP3
    Posts
    3

    Re: Macros stop working, supposed to find next empty cell in column and label...

    Thank begonias!

    And that's good to know that it can be changed to show the error. You're awesome!

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2013
    Posts
    4,337

    Re: Macros stop working, supposed to find next empty cell in column and label...

    @Axil
    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as "SOLVED".
    For the meantime I'll do it for you.

    How?
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Note:
    You can also thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given.
    By doing so you can add to the reputation(s) of those who helped and shared their time in helping you.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Registered User
    Join Date
    11-06-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2002 (10.6871.6870) SP3
    Posts
    3

    Re: Macros stop working, supposed to find next empty cell in column and label...

    Ahh I see, thank you, will do next time.

+ 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