If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Series Hyperlink or something like it
hi people,
I have created a new chart-sheet with 3 series on it. What I wanted to do is that when i click on the series, i will want the excel to run another piece of codes and generate another graph that is related. I do not know whether it's possible but if not is there anyway i can make any "interaction" such as using dialog box, msgbox when click on the chart? One more thing i need to remind, is that the charts are generated from codes, not plotted manually. So there is no way to code in the charts before it's generated. Thank You |
#2
|
|||
|
|||
Series Hyperlink or something like it
Kaiyang -
You can have a class module in the workbook that enables chart events: http://support.microsoft.com/default...b;en-us;213738 It usually is used for events in embedded charts, which are not backed up by a code module in the workbook's VBA project. But it can be applied to chart sheets as well. In step 8 of the MSKB article, use this code instead: Sub Set_Chart() Set mychart.EmbChart = ActiveChart End Sub You could alternatively set up an application events class that, when a sheet is activated, enables events for the chart (if it's a chart sheet) or for any embedded charts on the sheet (chart sheet or worksheet). You could also have your code write the chart event procedure behind the chart sheet it creates. Finally you need an event procedure in the chart events class module that detects a click on a series or point: Private Sub EmbChart_Select(ByVal ElementID As Long, _ ByVal Arg1 As Long, ByVal Arg2 As Long) MsgBox "You've selected chart element " & ElementID & _ " (" & Arg1 & ", " & Arg2 & ")." End Sub If ElementID is that of a series, Arg1 is the series number and Arg2 is the point. I have some of this on my web site: http://peltiertech.com/Excel/Charts/...html#PointInfo - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services http://PeltierTech.com/Excel/Charts/ _______ Kaiyang wrote: hi people, I have created a new chart-sheet with 3 series on it. What I wanted to do is that when i click on the series, i will want the excel to run another piece of codes and generate another graph that is related. I do not know whether it's possible but if not is there anyway i can make any "interaction" such as using dialog box, msgbox when click on the chart? One more thing i need to remind, is that the charts are generated from codes, not plotted manually. So there is no way to code in the charts before it's generated. Thank You |
Thread Tools | |
Display Modes | |
|
|