Microsoft Office Tutorials and References
In Depth Information
Figure 16-16: Using the drop-down lists in a code module to select an event
The worksheet shown in Figure 16-17 contains five embedded charts, four of which
are hidden. Cell B2 controls which of the five charts is visible. This cell uses Data
Validation to display a list of values from 1 through 5, plus an additional entry:
(none) .
Figure 16-17: Cell B1 contains a drop-down list of chart numbers.
The selected chart number is visible and the others are hidden.
The worksheet uses a Worksheet_Change event procedure, which follows. The
macro is executed whenever a cell is changed on the sheet. Notice that this
procedure has an argument: Target . This argument is a variable that represents the cell
or range that is changed. If the address of Target is $B$2, the macro performs two
operations: It hides all members of the ChartObjects collection and then unhides
the chart that corresponds to the value in cell B2. The On Error statement ignores
the error that occurs if an invalid ChartObject number is referenced.
Search JabSto ::

Custom Search