Option Explicit
Private Sub Chart_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 myX As Variant, myY As Double
Dim TempStat As String
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
TempStat = Worksheets("Sheet1").Range("C" & (Arg2 + 1)).Value
MsgBox TempStat
End If
End If
End With
End Sub
Private Sub Chart_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 myX As Variant, myY As Double
Dim TempStat As String
Dim Tempval As String
Dim lstRow As Long
With ActiveChart
' Pass x & y, return ElementID and Args
.GetChartElement x, y, ElementID, Arg1, Arg2
' Check if we click over a point or data label?
If ElementID = xlSeries Or ElementID = xlDataLabel Then
If Arg2 > 0 Then
TempStat = Worksheets("Sheet1").Range("C" & (Arg2 + 1)).Value
'Lookup the respective comments
Tempval = Application.WorksheetFunction.VLookup(Sheet1.Range("B" & (Arg2 + 1)).Value, Sheet1.Range("B:C"), 2, False)
'You can change the sheet and column reference to your suit where you want to paste the data
lstRow = ThisWorkbook.Worksheets("sheet2").Range("A65000").End(xlUp).Row + 1
Sheet2.Range("A" & lstRow).Value = Tempval
' MsgBox TempStat
End If
End If
End With
End Sub
Private Sub Chart_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 myX As Variant, myY As Double
Dim TempStat As String
Dim Tempval As String
Dim lstRow As Long
With ActiveChart
' Pass x & y, return ElementID and Args
.GetChartElement x, y, ElementID, Arg1, Arg2
' Check if we click over a point or data label?
If ElementID = xlSeries Or ElementID = xlDataLabel Then
If Arg2 > 0 Then
'According to your new suggested data layout, respective comment will be picked up as you clicked on the data label on the chart
Tempval = Worksheets("Sheet1").Cells(3, (Arg2 + 1)).Value
'You can change the sheet and column reference to your suit where you want to paste the data
lstRow = ThisWorkbook.Worksheets("sheet2").Range("A65000").End(xlUp).Row + 1
Worksheets("Sheet2").Range("A" & lstRow).Value = Tempval
MsgBox "Comment is successfully picked up and placed in sheet2. Please visit sheet2 for the same."
End If
End If
End With
End Sub
Private Sub Chart_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 myX As Variant, myY As Double
Dim TempStat As String
Dim Tempval As String
Dim lstRow As Long
With ActiveChart
' Pass x & y, return ElementID and Args
.GetChartElement x, y, ElementID, Arg1, Arg2
' Check if we click over a point or data label?
If ElementID = xlSeries Or ElementID = xlDataLabel Then
If Arg2 > 0 Then
'According to your new suggested data layout, respective comment will be picked up as you clicked on the data label on the chart
Tempval = Worksheets("Sheet1").Cells(14, (Arg2 + 1)).Value
MsgBox Tempval
End If
End If
End With
End Sub