Home |
Search |
Today's Posts |
#2
![]() |
|||
|
|||
![]()
Hi Robert,
The easiest way I've found to do this is by using the Chart_Select event to detect clicks on the legend for each series, and toggle visibility based on that. It works just fine for one chart, but I don't know how to add the event from scratch - starting with a tab delimited file, remember - or if it can be added in such a way as to make it happen on all charts. One way is to use a class module: Class CChartEvents Public WithEvents mchtChart As Chart Private Sub mchtChart_Select(ByVal ElementID As Long, _ ByVal Arg1 As Long, ByVal Arg2 As Long) ' your code End Sub Then in a standard module, create a new instance of this class for each chart sheet: Dim mEventClasses As Collection Sub SetUpChartEvents() Dim chtChart As Chart Dim clsChartEvents As CChartEvents Set mEventClasses = New Collection For Each chtChart In ThisWorkbook.Charts Set clsChartEvents = New CChartEvents Set clsChartEvents.mchtChart = chtChart mEventClasses.Add clsChartEvents Next End Sub With this approach, you could store the standard and class modules a text files and programmatically add them to any workbooks you generate. (see Chip's VBE page for details at www.cpearson.com). Regards Stephen Bullen Microsoft MVP - Excel www.oaltd.co.uk |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple sheets selected | Excel Discussion (Misc queries) | |||
There is no way to view multiple sheets from one workbook | Excel Discussion (Misc queries) | |||
Linking sheets to a summary sheet in workbook | Excel Discussion (Misc queries) | |||
how do i switch between multiple sheets in the same workbook (key. | Excel Discussion (Misc queries) | |||
linking multiple sheets to a summary sheet | Excel Discussion (Misc queries) |