Animated charts

Most people don't realize it, but Excel is capable of performing simple animations. For example, you can animate shapes and charts. Consider the XY chart shown in Figure 18-17.

Figure 18-17: A simple VBA procedure will turn this graph into an interesting animation.

The X values (column A) depend on the value in cell A1. The value in each row is the previous row's value, plus the value in A1. Column B contains formulas that calculate the SIN of the corresponding value in column A. The following simple procedure produces an interesting animation. It simply changes the value in cell A1, which causes the values in the X and Y ranges to change.

Sub AnimateChart() Dim i As Integer Range("A1") = 0 For i = 1 To 150

Range("A1") = Range("A1") + 0.035 Next i

Range("A1") = 0 End Sub on the <d on the <d

The companion CD-ROM contains a workbook that includes this animated chart, plus several other animation examples.

+1 0

Post a comment