From the course: Excel VBA: Managing Files and Data
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Add or remove data series from a chart
From the course: Excel VBA: Managing Files and Data
Add or remove data series from a chart
- [Instructor] One task that can be automated in a straightforward manner using Excel VBA is to add a data series to an existing chart. And in this movie I will show you how to do that. My sample file is 05_03_AddSeries, and you can find it in the Chapter 5 folder of the Exercise Files collection. On this worksheet, I have two series of data. I have the number of room nights for days of the week, which is very important in the hotel industry, and there are two room types that we're tracking. The first is Lovejoy, which is already displayed and summarized in the chart, and the second is Thurman, which is not. So our task is to use Excel VBA to add the Thurman data to the chart. I've already started the work, so I'll go to the Visual Basic Editor by pressing Alt + F11. And here I have a subroutine called AddDataSeries. At the top, I have a variable, and it's an integer, and it counts the number of series. And below that, I have code that first activates the March worksheet. It's the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Create a chart4m 38s
-
(Locked)
Move a chart to a chart sheet4m 1s
-
(Locked)
Add or remove data series from a chart4m 58s
-
(Locked)
Export a chart as an image3m 56s
-
(Locked)
Create a line sparkline3m 2s
-
Create a column sparkline3m 13s
-
(Locked)
Create a win/loss sparkline4m 24s
-
(Locked)
Delete a sparkline1m 47s
-
(Locked)
-
-
-
-