Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2005
    Location
    Kamloops, Br. Columbia, Canada
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Charts - automating scale on Y axis (XP)

    I would like to automate the Y axis scale for a chart displaying variable dates. I have experimented with giving range names to the start and end dates - result unsuccessful. Is there a simple solution or does the answer lie in VBA?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Charts - automating scale on Y axis (XP)

    Welcome to Woody's Lounge!

    By default, Excel adapts the scale of chart axes automatically when the source data change. If you want to set the scale yourself based on the source data, you will need to use VBA, for example

    Worksheets("Sheet1").ChartsObjects(1).Chart.Axes(x lValue).MinimumScale = Worksheets("Sheet1").Range("C2")

  3. #3
    New Lounger
    Join Date
    Feb 2005
    Location
    Kamloops, Br. Columbia, Canada
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Charts - automating scale on Y axis (XP)

    Thanks for your reply Hans,
    The problem I was trying to resolve was that my data started on 02/22/05 and ended on 08/06/05 but the chart automatically set the Y axis minimum as 11/19/04 and the maximum as 09/15/05. The result was a lot of wasted space on the chart and a very compressed chart. Over time, I want to alter the start and end dates and want to avoid manually resetting the scale.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Charts - automating scale on Y axis (XP)

    OK, in that case you could write a macro that sets the minimum and maximum scale for the axis, using instructions similar to the one in my previous reply. You can create a command button on the form to run the macro, or a custom toolbar button.

    Post back if you need more assistance.

  5. #5
    New Lounger
    Join Date
    Feb 2005
    Location
    Kamloops, Br. Columbia, Canada
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Charts - automating scale on Y axis (XP)

    Thanks Hans, it worked a treat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •