View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Get Max & Min from a chart series

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.SeriesCo llection(SeriesIndex).Values)
End Function
Function GetChartMin(MyChart As Chart, SeriesIndex As Integer) As Double
GetChartMin =
Application.WorksheetFunction.Min(MyChart.SeriesCo llection(SeriesIndex).Values)
End Function


Cheers
Andy

Joe wrote:

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


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info