Assume this:
I have plotted XY data in a chart. Call the value series 'MySeries', and assume its "SeriesCollection" number is 20.
If, in a VisualBasic macro, I do this:
Sheets("MyGraphs").Select
ActiveChart.SeriesCollection(20).Points(84).Select
the 84-th point in 'MySeries' in the chart on sheet 'MyGraphs' is selected.
But how do I do "the reverse"?
I.e. assume I select a point in the plot of 'MySeries' on the chart on sheet 'MyGraphs', how do I get the number in the data series 'MySeries'?
Assume the sheet "MyData" contains 3 columns:
The X-values of 'MySeries'
The Y-values of 'MySeries'
A comment to each XY pair
Let's assume I have created a button in or close to the graph area. I want the service handler to this button, in sheet "MyGraphs",
to select sheet "MyData" and the comment cell on the row where the X and Y for the selected point are.
This will require a function we could call
getNumberInSeries(SelectedPt as Point) As Integer
The procedure would be like (of course there is "Dim SelectedPoint As Point", "Dim PointNumber As Integer" in the declaration section):
Set SelectedPoint = Selection
PointNumber = getNumberInSeries(SelectedPoint)
...
What could 'getNumberInSeries' look like?
Bookmarks