Hello all. I am using chart events to highlight a series collection in a chart when the the mouse is clicked on a legend entry (courtesy of Peltiertech.com). In addition to highlighting the series I am also trying to find the maximum value in the highlighted series and add a label or highlight that point. I am a novice so I really just hope and poke around until I get it right. I am having problems returning the y axis value of a data point and was hoping someone could nudge me in the right direction. I have tried the following with many variations:
Code:Private Sub FindMaxSeriesData() Dim fmSeriesCount, old fmSeriesCount = Me.SeriesCollection(Arg1).Points.Count maxDataPoint = fmSeriesCount old = fmSeriesCount Do fmSeriesCount = fmSeriesCount - 1 'Here is where I am having problems. I do not know how to return the value of the point. If Me.SeriesCollection(Arg1).Points(fmSeriesCount).curryvalue > _ Me.SeriesCollection(Arg1).Points(old).curryvalue Then maxDataPoint = fmSeriesCount End If Loop While fmSeriesCount <> 0 End Sub
Last edited by mchristisen; 05-29-2009 at 12:19 PM.
As you presumably know the range of the source data, you should be able to deduce which row in this range is linked to the point in question based upon its index number.
Martin
Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.
If my solution has saved you time and/or money, please consider donating to Cancer Research UK.
This will return the maximum value.
this will loop through the valuesCode:msgbox application.WorksheetFunction.Max(activechart.SeriesCollection(Arg1).values)
Code:for each vntValue in activechart.SeriesCollection(1).values: debug.Print vntValue: next vntvalue
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks