+ Reply to Thread
Results 1 to 7 of 7

Run macro once exiting chart (or just before exiting chart)

  1. #1
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Run macro once exiting chart (or just before exiting chart)

    I need to run a macro once changes were made to a chart via the use of Chart Filters (via the funnel icon) or after clicking on an active chart and using Select Data to uncheck/check series boxes. I’m hoping there is a possible solution to one of the two questions below:

    1. Can a macro be triggered to run related to the above actions before a person can exit out of the chart and onto the spreadsheet it is on?
    2. Or, is there something that can trigger a macro once a person does exit out of the chart and onto the spreadsheet it is on?

    Including the macro here might be helpful in forming a solution. This macro needs to run so that the series can pull the max-Y value the chart has automatically determined, and therefore, allow it to be properly graphed on the chart. As you can see, it has to happen after the fact.
    Please Login or Register  to view this content.
    Thoroughly stumped here. Any help will be greatly appreciated!

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,158

    Re: Run macro once exiting chart (or just before exiting chart)

    It would be a good idea to include a sample workbook containing said chart. How do I attach the file? See the yellow banner at the top of this page.

    Artik

  3. #3
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Run macro once exiting chart (or just before exiting chart)

    To see an example of the problem, execute the following sequences.
    1. On sheet Day1_5, click on upper right corner of chart, then on the funnel icon to activate the Chart Filters box. Then uncheck the Data 1 box followed by the “Apply” button bottom left below. (Alternatively, right-click the chart and click on the Select Data option, uncheck the Data 1 box there and click OK.)
    2. Note that the phase line is overly tall and of the number 80 in cell U4.
    3. Click on the “Phase” button in cell O4 and note how chart re-graphs and number changed to 60 in cell U4.

    I want to eliminate the Phase button and the chart to automatically accommodate the phase line.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,158

    Re: Run macro once exiting chart (or just before exiting chart)

    Chart events are handled through own class. Unfortunately, it does not have event that react to a change in filtering. That leaves only the chart deactivation event.
    Go through all the modules, because the code is in many places.

    Artik
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,369

    Re: Run macro once exiting chart (or just before exiting chart)

    Administrative Note:

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until you provide a link or, for members with fewer than 10 posts, a comment telling us where else you have posted this query.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Run macro once exiting chart (or just before exiting chart)

    Artik,

    It works!
    I am sincerely grateful for your generousity, considering the time and energy you must have provided in solving this case. I see now why you needed the workbook to do this. I saw that 12 codes were rewritten/created to make this happen, including the creation of several class module codes. This obviously required a higher level of know-how and creativity than I thought would be necessary to get the phase button dumped.

    May I someday return the favor in like manner for someone like this. Very cool!

  7. #7
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Run macro once exiting chart (or just before exiting chart)

    I posted on OzGrid the line below.
    "Run macro after .IsFiltered = True function".

    It is a simple question whether it is possible to do this. It didn't include an attachment. I'll admit it was indirectly related to this post but didn't think I was violating anything.
    Regardless, I sincerely apologize if I offended anyone.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to turn off autofilter when exiting sheet not working
    By Mr_Phil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2020, 03:18 PM
  2. User Form Calling another Macro instead of exiting and Stopping all macros
    By Vikramravikumar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2019, 12:36 PM
  3. exiting the entire macro
    By Suraj3825 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2013, 03:33 PM
  4. [SOLVED] Exiting a macro if not physically on a certain worksheet
    By AliJay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-31-2012, 06:52 AM
  5. [SOLVED] Exiting Excel from an Outlook Macro
    By Alves76 in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2012, 05:07 AM
  6. Exiting called macro on error, then ending macro caller.
    By Yappa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2008, 10:28 PM
  7. macro to remind doing some task before exiting file.
    By Krzys in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-16-2007, 03:51 PM

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