Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Replace the message box code with:
Worksheets("My Sheet").Range("A3").Value = myX Worksheets("My Sheet").Range("B3").Value = myY - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "billinr" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Perfect!
Thanks AGAIN, Jon. "Jon Peltier" wrote: Replace the message box code with: Worksheets("My Sheet").Range("A3").Value = myX Worksheets("My Sheet").Range("B3").Value = myY - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "billinr" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to extract the address of a chart serie | Charts and Charting in Excel | |||
Extract values off a chart??? | Charts and Charting in Excel | |||
How do I extract an Excel Chart as a graphics file? | Excel Worksheet Functions | |||
how to extract a specific range of days (7 or 30) to make a chart | Excel Worksheet Functions | |||
Formula to extract pricing from a chart | Excel Worksheet Functions |