Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SD SD is offline
external usenet poster
 
Posts: 24
Default clicking on a point in a scatter chart

hi i'm trying to write a macro that;
when i click on a point on a scatter plot (but it has to be clicked twice
otherwise the series is selected, rather than the point), i need to read the
cell addresses for that point
all help greatly appreciated
SD
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default clicking on a point in a scatter chart

See John Walkenback at:

http://j-walk.com/ss/excel/odd/odd15.htm

As per John Walkenbauch at the above reference, it is not possible to obtain
the source range for a chart series using VBA. John describes a technique of
parsing the chart Series Formula to obtain the source address.

In short, the information cannot be obtained using VBA by itself. However,
if you already know the source range and you only want to return the source
address of an individual point within the source range by clicking the point,
you can use the GetChartElement method to return the index value of the point
and use that as an offset within the known source range. The following
example assumes that the source range is a named range called "ChartVals" and
that the chart is a chart sheet as opposed to an embedded chart.

Paste to the chart sheet code module:

Private Sub Chart_MouseDown(ByVal Button As Long, _
ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
Dim ID As Long, a As Long, b As Long
With Me
.GetChartElement x, y, ID, a, b
MsgBox "Point index value = " & b & vbCr & _
"Point source address = " & Range("ChartVals")(b).Address
End With
End Sub

Note: If the chart is embedded then you need to resort to a Class module
techinique.

Regards,
Greg


"SD" wrote:


hi i'm trying to write a macro that;
when i click on a point on a scatter plot (but it has to be clicked twice
otherwise the series is selected, rather than the point), i need to read the
cell addresses for that point
all help greatly appreciated
SD

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Labeling each data point in scatter chart Kris Charts and Charting in Excel 2 February 6th 09 06:11 PM
Scatter Chart individual point changes duketter Charts and Charting in Excel 6 September 18th 07 10:47 PM
Scatter Chart Data Point Highlighting rvExcelNewTip Charts and Charting in Excel 6 January 8th 06 05:21 PM
Retrieve point address from scatter plot by clicking? Jdoggrr Charts and Charting in Excel 3 October 21st 05 02:02 PM
On a scatter chart show two point have same value Maz Page Charts and Charting in Excel 1 December 16th 04 01:00 PM


All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"