Click on Chart to identify series/point

mcget

New Member
Joined
Feb 26, 2008
Messages
47
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
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
thank you, but this isnt what i meant. What i need is the ability to click on the actual bar in a chart to perform the action of populating a cell with the point name!
 
Upvote 0
This example uses a Chart sheet. I got it to work great. Does anyone know the specifics to modify it such that it works for an Embedded Chart too? I have seen examples but never with enought step-by-step to actually get it to work for me...
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,931
Members
449,134
Latest member
NickWBA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top