How to Create Animated Charts in Excel (with Easy Steps)

We have taken a dataset of monthly sales for 3 consecutive years: 2020, 2021, and 2022. We will generate a chart that changes automatically.

Dataset


Step 1 – Setting up a Chart with Helper Columns

  • Insert three helper “Sales” columns.

Setting up a Chart with Helper Column to create animated charts in Excel

Note: You can highlight the helper columns for better visualization.

  • Move to a blank cell.
  • Navigate to the Insert tab.
  • Under the Charts section, choose Insert Line or Area Chart and pick Stacked Line.

Insert chart to create animated charts in Excel

  • Right-click on the chart and click on Select Data.

  • The Select Data Source dialog box pops out.
  • Choose Add from the Legend Entries (Series).

Select Data Source window

  • You will see the Edit Series window.
  • In the Series Name box, select Sales (2020), and in the Series values box, select the data range $F$5:$F$16.
  • Press OK.

Edit Series dialog box to create animated charts in excel

  • Repeat to select all the “Sales” columns and the respective helper columns.

  • Moreover, in the Horizontal (Category) Axis Labels, move to Edit.

  • Subsequently, the Axis Labels dialog box pop out. Select the data range from $B$5:$B$16. Click OK.

Axis labels window

Finally, hit OK in the Select Data Source window.

Read More: How to Create Animated Bar Chart Race in Excel


Step 2 – Formatting the Chart

  • Create the Chart Title, the Axis Titles, and the Legend at the bottom. These are available from Chart Elements.

Format the Chart to create animated charts in Excel

Your chart will look something similar to the image below.


Step 3 – Using VBA Code

  • Go to the Developer tab and choose Visual Basic.

Employing a VBA Macros to create animated charts in Excel

  • Choose the Insert tab and select Module.

  • In Module 1, you will see the General box.
  • Put the following VBA code there and save it.
Sub AnimationChart()
    Const SR As Long = 5
    Dim LR As Long
    Dim RN As Long
    LR = Range("C" & SR).End(xlDown).Row
    Range("F" & SR, "H" & LR).ClearContents
    DoEvents
    Application.Wait (Now + TimeValue("00:00:1"))
    For RN = SR To LR
        DoEvents
        Range("F" & RN, "H" & RN).Value = Range("C" & RN, "E" & RN).Value
        Application.Wait (Now + TimeValue("00:00:1"))
        DoEvents
    Next RN
End Sub

VBA code to make animated charts in excel

Code Breakdown

We declare the variables first. We set the Constant as SR representing Starting Row. In our case, it is 5. The LR and RN are also variables referring to the values of the Last Row and Row Number respectively.

LR = Range(“C” & SR).End(xlDown).Row→command removes all the values of the associated column (F: H).

Range(“F” & SR, “H” & LR).ClearContents→picked the range of cells, started showing the cell values row by row and filled the blank columns of F to H.

We have set the Time delay to 1 second, which will help us show the data at a 1-second delay, which gives a dynamic vibe to the chart.


Step 4 – Entering a Button to Generate the Animation

  • Add a button using Form Controls in your worksheet.
  • Rename it to Animation.
  • Right-click on the Animation button and choose Assign Macro from the Context Menu.

Enter a Button to Generate the Animation

  • The Assign Macro dialog box appears.
  • Select the Macro name as AnimationChart.
  • Press OK.

  • The animated chart is ready. Click on the Animation button.

Animated Charts gif


Practice Section

We have provided a practice section on each sheet on the right side so you can practice the steps.

Practice Section


Download the Practice Workbook


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Fahim Shahriyar Dipto
Fahim Shahriyar Dipto

Fahim Shahriyar Dipto is a graduate of Mechanical Engineering at BUET. With over 1.5 years of experience at Exceldemy, he authored 70+ articles on ExcelDemy. He has expertise in designing worksheets at You’ve Got This Math. Currently, He is a Team Leader at Brainor. Dipto's passion extends to exploring various aspects of Excel. Beyond tech, he enjoys creating engaging kids' worksheets using Illustrator. A dedicated employee and innovative content developer, He incorporates a commitment to academic excellence and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo