Microsoft Office Tutorials and References
In Depth Information
Figure 18-21: A simple VBA procedure will turn this graph into an interesting animation.
The key to chart animation is to use one or more DoEvents statements. This statement passes
control to the operating system, which (apparently) causes the chart to be updated when control
is passed back to Excel. Without the DoEvents statements, the chart’s changes would not be
displayed inside of the loop.
The companion CD-ROM contains a workbook that includes this animated chart, plus
several other animation examples. The filename is animated charts.xlsm .
Scrolling a chart
Figure 18-22 shows a chart with 5,218 data points in each series. The workbook contains six names:
h StartDay : A name for cell F1.
h NumDays : A name for cell F2.
h Increment : A name for cell F3 (used for automatic scrolling).
h Date : A named formula:
h ProdA : A named formula: