I have a Volume vs. Area plot. Here is the format of the worksheet
length | width | depth | Area | Volume
I would like to use chart events (Mouse Up event) to get me information about not only area and volume but also l, w, and d.
I know that following code give me info about x and y (i.e. area and volume.) But how to modify this code, so that I also get
"L= , W= , D= , A= , V= ."
Thanks in advance.
length | width | depth | Area | Volume
I would like to use chart events (Mouse Up event) to get me information about not only area and volume but also l, w, and d.
I know that following code give me info about x and y (i.e. area and volume.) But how to modify this code, so that I also get
"L= , W= , D= , A= , V= ."
Thanks in advance.
Code:
With ActiveChart
' Pass x & y, return ElementID and Args
.GetChartElement x, y, ElementID, Arg1, Arg2
' Did we click over a point or data label?
If ElementID = xlSeries Or ElementID = xlDataLabel Then
If Arg2 > 0 Then
' Extract x value from array of x values
myX = WorksheetFunction.Index _
(.SeriesCollection(Arg1).XValues, Arg2)
' Extract y value from array of y values
myY = WorksheetFunction.Index _
(.SeriesCollection(Arg1).Values, Arg2)
' Display message box with point information
MsgBox "Series " & Arg1 & vbCrLf _
& """" & .SeriesCollection(Arg1).Name & """" & vbCrLf _
& "Point " & Arg2 & vbCrLf _
& "X = " & myX & vbCrLf _
& "Y = " & myY
End If
End If
End With