View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.charting
Kelly O'Day
 
Posts: n/a
Default Can I reference the min and max values of an axis to a cell?

Gary:

You may want to take a look at my tutorial on how to add horizontal lines
with min and max dates. Ihave it set for dates, you could easily adjust to
non-dates.

http://processtrends.com/pg_charts_horizontal_line.htm

The idea is to assign range names for start and end dates as well as major
unit and number format.

When you run the macro, its reads the start and end ranges and assigns those
values to min & max X axis scale. With a little extra effort, you could
create a worksheet change event that triggers a chart refresh any time you
change the start/end dates.

Here's the code I use in that example.

Public Sub x_Axis()
With ActiveSheet.ChartObjects(1).Chart.Axes(xlCategory, xlPrimary)
.MinimumScale = Range("start")
.MaximumScale = Range("end")
.MajorUnit = Range("major_unit")

.TickLabels.NumberFormat = Range("date_format")

End With
End Sub

You'll need to tailor to your situation, however,this should get you
started.

...Kelly




"garyboom" wrote in message
...
I'm trying to dynamically create some charts that move by date. I would
like
to also be able to change the scale of the axis. Basically, I want the
max
value +10 and the min value -10. Is there a way to change the axis values
by
linking to a cell instead of entering a value?