LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 38
Default Extract X data from Chart

I have looked through the information provided by this group for chart
events, and I have a good code to get the embedded chart to show the message
box with the point information. (Thanks Jon Peltier)
What I would like to do now is to extract that X data and paste it into
another area of the workbook to run some other analysis.

Is there some way to have the X value be copied into another cell on another
sheet?

I am using this code in a MouseUp event:


Dim ElementID As Long, Arg1 As Long, Arg2 As Long
Dim myX As Variant, myY As Double

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 "Series " & Arg1 & vbCrLf _
& """" & .SeriesCollection(Arg1).Name & """" & vbCrLf _
& "Point " & Arg2 & vbCrLf _
& "X = " & myX & vbCrLf _
& "Y = " & myY
End If
End If
End With



Thanks for the help

 
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
How to extract the address of a chart serie Vinz Charts and Charting in Excel 1 December 6th 06 05:24 PM
Extract values off a chart??? BuickGN87 Charts and Charting in Excel 3 October 6th 06 10:40 AM
How do I extract an Excel Chart as a graphics file? Dick Hanneman Excel Worksheet Functions 7 May 6th 06 03:05 AM
how to extract a specific range of days (7 or 30) to make a chart accented Excel Worksheet Functions 0 January 9th 06 09:51 PM
Formula to extract pricing from a chart John F Excel Worksheet Functions 2 November 12th 04 02:04 PM


All times are GMT +1. The time now is 10:29 PM.

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

About Us

"It's about Microsoft Excel"