+ Reply to Thread
Results 1 to 5 of 5

Chart event on axis scale change

Hybrid View

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    Canada
    MS-Off Ver
    Office365 32-bit
    Posts
    28

    Chart event on axis scale change

    I've got a worksheet with five embedded XY-scatter plots. The first one is the "main" chart and I've got a macro that copies the y-axis scale settings of the first one onto the other four. Right now the macro is triggered via a button, but I was wondering if there is a way to trigger it via a chart event. Specifically, I was wondering if there is a way to run the macro whenever a change is made to the scale of the y-axis in the first chart. From what I can tell, all chart events with the exception of 'Calculate' are triggered before any changes occur, and the 'Calculate' event isn't much use since it's only triggered when the series data changes.

    Does anyone have any suggestions of a workaround or are we stuck with using the button?

    Thanks!

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Chart event on axis scale change

    One suggestion that I have is that when you change the scale on the chart, have that macro write to a cell on the spreadsheet and then run a change event on that cell to set the other axis.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

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

    Re: Chart event on axis scale change

    There is not an after event so all you have is the Select event.
    You could capture what has been selected and then once the axis is selected either wait for something else to be selected or run a macro using OnTime.

    @dflak, if aprimak were using a macro to change the axis then would it not make sense to update all the others at the same time, therefore not needing an event?
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Chart event on axis scale change

    My impression is that he is doing it manually for one chart and wants the other charts to follow suit.

  5. #5
    Registered User
    Join Date
    10-01-2012
    Location
    Canada
    MS-Off Ver
    Office365 32-bit
    Posts
    28

    Re: Chart event on axis scale change

    dflak, I'm not sure I understand; what macro are you referring to? if something triggered that "change cell" macro, then why couldn't I simply use that trigger to call my "update chart" macro? That's exactly my problem.

    Andy Pope's suggestion of activating the macro (with the appropriate axis change checks) after something else is selected is something I've thought about, but I'm kind of concerned of the potential for the users to do something truly bizarre which would either not trigger that event or even cause a crash. I really hate that particular breed of "Hey! I found a new bug" conversations.

    I guess the command button is still (relatively speaking) the most fool-proof way of doing this after all.

    Many thanks guys!

+ 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. Replies: 3
    Last Post: 04-09-2018, 10:42 AM
  2. [SOLVED] How to keep scale of chart with secondary axis the same, after deleting the axis'
    By luv2glyd in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-14-2017, 02:28 PM
  3. [SOLVED] Worksheet Event - update chart axis scale, depending on cell value
    By Jabba69 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2014, 06:41 AM
  4. Using log scale for chart axis
    By xcelsie in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-04-2009, 07:22 PM
  5. Chart X axis out of scale
    By vtodorov in forum Excel General
    Replies: 4
    Last Post: 08-27-2008, 06:51 PM
  6. [SOLVED] Can't change the scale of values on a y-axis on a line chart
    By ags in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-07-2006, 07:40 PM
  7. [SOLVED] How do I change a Chart's axis scale from visual basic?
    By jfiorillo in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-21-2006, 03:45 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