+ Reply to Thread
Results 1 to 4 of 4

Controlling Minimum and Maximum Axes

  1. #1
    Registered User
    Join Date
    10-12-2009
    Location
    Falkirk, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    17

    Controlling Minimum and Maximum Axes

    I was told in a previous question that it was not hard to ensure that Excel would automatically set the minimum and maximum of a chart axis range to given percentages less and more than the observed minimum and maximum values in the range the chart is looking to plot.

    But it was mentioned that I would need to use code or macros. I am not in anyway programer and rarely understand Excel macros and how they work

    Despite this can someone help with me what that code might look like?

    And how I might run the code on individual charts?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,777

    Re: Controlling Minimum and Maximum Axes

    Are you asking the question generically, or do you want to apply this to a specific chart in a specific worksheet? If the latter, then if you attach the workbook it will be a lot quicker to get you a solution rather than starting from scratch. That means that you are more likely to get a response.

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Controlling Minimum and Maximum Axes

    Hi opsinmena,

    The following code will set the primary axis of Chart 1 to the values defined in the named ranges Ymax, Ymin, Ymajor and Yminor. If you assign that code to a button, you can specify or calculate your axis settings in the respective named ranges, then click the button to apply these numbers to both axes in one click.

    Please Login or Register  to view this content.
    If you have several charts on the sheet, you may need to adjust the macro to pick the correct chart. To find out the chart name, select a cell in your worksheet, then hold down the Ctrl key and select the chart. You will now see the chart name in the name box above cell A1.

    The code goes into a regular code module.

  4. #4
    Registered User
    Join Date
    10-12-2009
    Location
    Falkirk, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Controlling Minimum and Maximum Axes

    Thanks very much for your input. I think I understand the code and I will try to act on it.

    The question was generic since I would like all charts in the sheets I am constructing to adjust their Y axis ranges to be either at the maximum and minium values found in thier y-value ranges (Or better 20% above and below the observed max and min values).

    (does anyone know the basis on which the Auto feature on axes settings

    I have about 45 charts in the sheet each of extracts data from ranges spread across more than one table of data.

    If I run into problems I will develop a model sheet to illustrate what I am trying to do, and attach it to this thread at a later date.

    Thanks again.

+ 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