Use an approach like this.
Dim Xvals as Variant
Dim Yvals as Variant
Dim Xmax as Double
Dim Xmin as Double
Dim Xmean as Double
Dim Xdev as Double
Xvals = ActiveChart.SeriesCollection(i).XValues
Yvals = ActiveChart.SeriesCollection(i).Values
Xmax = WorksheetFunction.Max(Xvals)
Xmin = WorksheetFunction.Min(Xvals)
Xmean = WorksheetFunction.Average(Xvals)
Xdev = WorksheetFunction.StDev(Xvals)
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -
http://PeltierTech.com
_______
"Patachoup" wrote in message
...
hello,
I am looking forward coding a macro autoscaling a two vertical axis chart,
with matching major units.
This macro will be linked to the chart by an "OnClick" event
My questions in this context a
- How do you get the maximum and minimum values of a serie from a chart in
VBA, without referring to any sheet range ?
- How do you calculate the average and std dev of this serie? (to get the
major unit)
I already had a look at tons of forums and websites you suggested but
nobody
developped that kind of macro, except in AddIns...but I do not want to use
AddIns ;-)
Thanks in advance