Hi,
I am using Excel 365.
I like to get the name of the dots.
See attached pics.
Regards and thanks in advance,
Petur Jonsson
Hi,
I am using Excel 365.
I like to get the name of the dots.
See attached pics.
Regards and thanks in advance,
Petur Jonsson
Please provide a sample workbook. I did this a long time ago. Put the code on the same sheet with the chart.
Private Sub Chart_MouseUp(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 MyDate() As String, NumDates As Long, k As Long Dim InputDate As Date ' Get dates associated with the point NumDates = Range("MyDate").Count ReDim MyDate(NumDates) For k = 1 To NumDates MyDate(k) = Range("MyDate").Cells(k, 1) Next 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 MyDate(Arg2) & vbCrLf _ & "X = " & myX & vbCrLf _ & "Y = " & myY, vbOKOnly, "Data Information" End If End If End With End Sub
One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.
A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.
Thank you, I will send a sample book but I do not have time these days.
Thank you again.
Regards,
Petur
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks