+ Reply to Thread
Results 1 to 4 of 4

How to only execute onderlying macro's when cell value changes

  1. #1
    Registered User
    Join Date
    01-06-2019
    Location
    Amsterdam
    MS-Off Ver
    Office 365
    Posts
    8

    How to only execute onderlying macro's when cell value changes

    Hello, I hope someone can help me because I seem to be screwing up more than I should be.

    I have made an excel sheet which shows or hides a graphs based on the value of a cell
    if: "deze maand" then show graph 1 and hide graph 2.
    if: "Dit jaar" then show graph 1 and 2.

    In order to make this work automatically, I have also made a macro that changes a cell fill colour when either cell values are correct.
    This because excel seems to need an action in order to update the changes.

    The problem is that now that on any other cell changes, the Both macro runs. Deleting its history and making it impossible to use the "Undo" button.

    Is there any way I can adjust this code, so it first checks if there are any changes in cell a3, before executing the underlying steps.
    This so that the undo button is still in function and the cell fill action is only executed when the correct cell value changes (through a drop-down menu)

    _____________________________________________________________________________________________________________________________
    #
    Please Login or Register  to view this content.
    _____________________________________________________________________________________________________________

    I really hope someone could help with this, it's the last step of the process before I can send it out :-(

    Thanks in advanced!
    Last edited by MrDutch; 01-12-2019 at 02:33 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    11,921

    Re: How to only execute onderlying macro's when cell value changes

    Maybe the change event only:

    Please Login or Register  to view this content.
    BTW:

    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    01-06-2019
    Location
    Amsterdam
    MS-Off Ver
    Office 365
    Posts
    8

    Re: How to only execute onderlying macro's when cell value changes

    My god, it works perfectly!
    I've fighting this for hours, I can't thank you enough!

    I've entered your code and deleted the second part of the macro, now it works like clockwork :-)

    Thanks again!


    ps: apologies for wrongly posting my original code, I have edited the post!

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    11,921

    Re: How to only execute onderlying macro's when cell value changes

    You're welcome amd thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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