Private Sub AllChartClass_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
Dim ElementID As Long, Arg1 As Long, Arg2 As Long
Dim rngData As Range
Dim vntValueA As Variant
Dim vntValueB As Variant
Set rngData = Worksheets("Sheet1").Range("A2:E9")
With ActiveChart
' Pass x & y, return ElementID and Args
.GetChartElement x, y, ElementID, Arg1, Arg2
If ElementID = xlSeries And Button = xlPrimaryButton Then
If Arg2 > 0 Then
' Extract y value from array of y values
vntValueA = WorksheetFunction.Index _
(.SeriesCollection(1).Values, 1, Arg2)
vntValueB = WorksheetFunction.Index _
(.SeriesCollection(2).Values, 1, Arg2)
MsgBox .SeriesCollection(1).Name & " = " & vntValueA & vbLf & _
.SeriesCollection(2).Name & " = " & vntValueB & vbLf
End If
End If
End With
End Sub
Bookmarks