Get Max & Min from a chart series

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you return the Max and Min value of a series on a chart? Assume there there is only 1 series plotted across a time variable

The logical way is to calc this from the source data, however I want to o it this way as I have a number of graphs in an array where I want to set the MinimumScale and MaximumScale property based on the points in the chart. The source data is not the same for each worksheet

Regards

Joe
 
Hi Joe,

Try this code, watch the text wrapping.

Sub x()
MsgBox GetChartMax(ActiveChart, 1)
MsgBox GetChartMin(ActiveChart, 1)
End Sub
Function GetChartMax(MyChart As Chart, SeriesIndex As Integer) As Double
GetChartMax =
Application.WorksheetFunction.Max(MyChart.SeriesCollection(SeriesIndex).Values)
End Function
Function GetChartMin(MyChart As Chart, SeriesIndex As Integer) As Double
GetChartMin =
Application.WorksheetFunction.Min(MyChart.SeriesCollection(SeriesIndex).Values)
End Function


Cheers
Andy
 
Back
Top