+ Reply to Thread
Results 1 to 10 of 10

Workbook_SheetChange evet Macro not working

  1. #1
    Registered User
    Join Date
    09-11-2007
    Location
    Mobile, AL
    Posts
    11

    Workbook_SheetChange evet Macro not working

    Hello everyone,

    I found the following code elsewhere on the net, and have attempted to use it in my workbook to change the names of all 31 worksheets when a certain cell's (C7) value changes. The code looks good to me, so I cannot understand why it is not working. I am not getting error messages, just no changes to the sheet names.
    I believe this may be due to the value of C7 on each sheet being dictated by a formula, so the value is not being changed with the sheet active, but indirectly with a formula that pulls the value from a cell on another sheet, and then adds.
    (i.e. =TEXT('Populator Tools'!$C$25+1,"mm-dd-yy") )
    Am I completely off base with this assumption, or on the right track; and if I am on the right track how do I fix this so it works?
    Any advice will be helpful.
    Code Below.

    Thanks in Advance!

    The Workbook_SheetChange Code Stored in This Workbook Module
    Please Login or Register  to view this content.
    Illegal Character Checker/Cleaner - Stored in Module 1
    Please Login or Register  to view this content.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Have you considered driving your code from changes to $C$25 (assuming this is not a formula itself)?
    Martin

  3. #3
    Registered User
    Join Date
    09-11-2007
    Location
    Mobile, AL
    Posts
    11
    No, but I will try it and see if it works. --Thanks!

    Quote Originally Posted by mrice
    Have you considered driving your code from changes to $C$25 (assuming this is not a formula itself)?

  4. #4
    Registered User
    Join Date
    09-11-2007
    Location
    Mobile, AL
    Posts
    11
    Well, I tried it, and it almost worked....
    It changed the name of the Populator Tools worksheet to the date entered into C25, which I didn't want to happen; and didn't change the other 31 sheets in the workbook, which is what I did want to happen, and is the intention of the code.
    Thanks for trying though...
    Anyone else have an idea?

    Quote Originally Posted by ALaws
    No, but I will try it and see if it works. --Thanks!

  5. #5
    Registered User
    Join Date
    09-11-2007
    Location
    Mobile, AL
    Posts
    11

    Question Re-Post Bump --- Still need Help!!!

    I posted this message yesterday. I got one suggestion, but it didn't work out. Any help will be appreciated.

    Quote Originally Posted by ALaws
    Hello everyone,

    I found the following code elsewhere on the net, and have attempted to use it in my workbook to change the names of all 31 worksheets when a certain cell's (C7) value changes. The code looks good to me, so I cannot understand why it is not working. I am not getting error messages, just no changes to the sheet names.
    I believe this may be due to the value of C7 on each sheet being dictated by a formula, so the value is not being changed with the sheet active, but indirectly with a formula that pulls the value from a cell on another sheet, and then adds.
    (i.e. =TEXT('Populator Tools'!$C$25+1,"mm-dd-yy") )
    Am I completely off base with this assumption, or on the right track; and if I am on the right track how do I fix this so it works?
    Any advice will be helpful.
    Code Below.

    Thanks in Advance!

    The Workbook_SheetChange Code Stored in This Workbook Module
    Please Login or Register  to view this content.
    Illegal Character Checker/Cleaner - Stored in Module 1
    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    A change to a formula value by the sheet being recalculated does not trigger a Workbook_SheetChange event macro

    It will triggers a Workbook_SheetCalculate or a Worksheet_Calculateevent macro
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  7. #7
    Registered User
    Join Date
    09-11-2007
    Location
    Mobile, AL
    Posts
    11
    Well, this definatly had an effect, and I think we are on the right track.
    I took the code from above, and put it in a Workbook_Sheet Calculate Event Macro. Then, after holding my breath, I changed the value in C25 on the first sheet (the cell driving the formulas in C7 on all the others) and ....
    I got an error message:

    Run-time error '424':

    object required

    The line highlighted in the VBA window (debuger) was:

    Please Login or Register  to view this content.
    Unfortuanatly because this is code written by someone else, I don't exactly know how to go about fixing this. Any thoughts?

    Thanks for everything so far, and everything that may come.
    Amber

    Quote Originally Posted by mudraker
    A change to a formula value by the sheet being recalculated does not trigger a Workbook_SheetChange event macro

    It will triggers a Workbook_SheetCalculate or a Worksheet_Calculateevent macro
    Last edited by ALaws; 03-07-2008 at 05:15 PM.

  8. #8
    Registered User
    Join Date
    09-11-2007
    Location
    Mobile, AL
    Posts
    11

    I thought this might help

    Just in case it would help anyone grasp what I am trying to accomplish, I thought I should include a copy of the workbook.
    Please note:
    I have changed back the code from the previous post due to the error message. I didn't want to lock up anyone elses computer. I only got out of it by Ctrl+Alt+Delete.

    Thanks again to anyone who is looking into the problem.
    Amber
    Attached Files Attached Files

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Amber,

    I add the following macro to your workbook which is attached. With this macro you no longer need the user to press CTRL+Shift+G to update the worksheet names. Once the date is entered into C25 on the Populator Tools sheet, all the other sheets' names are changed.

    Populator Tools event macro
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  10. #10
    Registered User
    Join Date
    09-11-2007
    Location
    Mobile, AL
    Posts
    11

    Talking Ingenious!

    Thank you soooooooo much Leith, your solution was both simple and beautiful!

    Great Job!

    I would also like to say that am so glad I found the forum some years back. Every time I have had one of these big issues you all have been there to help me gather the pieces and make it work.

    To all of you who have helped through the years...

    Thank You!

+ 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