Hi,
I know that you can use a chart click event to do this, but i just cannot get it to work.
What i need to do, is by clicking on a chart series, i can get the chart point name input into a cell, say a2.
I think the code below if fine, i just dont know how to enter the correct things after the call function below, (???).
Public WithEvents calchart As chart
Private Sub calchart_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
Dim ElementID As Long
Dim Arg1 As Long
Dim Arg2 As Long
Dim chart_label As Variant
Dim chrt As chart
Dim ser As Series
Dim activity As String
On Error Resume Next
'use the GetChartElement to return information about the part of the chart that has
'been clicked on by the user
calchart.GetChartElement x, y, ElementID, Arg1, Arg2
'assign the series names to an array
Set chrt = ActiveChart
Set ser = ActiveChart.SeriesCollection(1)
chart_label = ser.XValues
If ElementID = xlSeries Then
activity = chart_label(Arg2)
Call identify(???)
End If
End Sub
I know that you can use a chart click event to do this, but i just cannot get it to work.
What i need to do, is by clicking on a chart series, i can get the chart point name input into a cell, say a2.
I think the code below if fine, i just dont know how to enter the correct things after the call function below, (???).
Public WithEvents calchart As chart
Private Sub calchart_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
Dim ElementID As Long
Dim Arg1 As Long
Dim Arg2 As Long
Dim chart_label As Variant
Dim chrt As chart
Dim ser As Series
Dim activity As String
On Error Resume Next
'use the GetChartElement to return information about the part of the chart that has
'been clicked on by the user
calchart.GetChartElement x, y, ElementID, Arg1, Arg2
'assign the series names to an array
Set chrt = ActiveChart
Set ser = ActiveChart.SeriesCollection(1)
chart_label = ser.XValues
If ElementID = xlSeries Then
activity = chart_label(Arg2)
Call identify(???)
End If
End Sub