The Chart Object
- 01:39
Understanding how to refer to a chart object in the chart object model.
Downloads
No associated resources to download.
Transcript
Charts are objects in Excel and like worksheets and range objects, they have their own properties and methods.
Charts also have events, which means that Excel VBA code can be executed when a certain action is performed by a user.
If we wish to change the properties of a chart, we need to know how to refer to the chart object in the chart.
Object model. Embedded charts or charts that are displayed in a worksheet are an object within a worksheet object, and the chart object itself is a member of the chart objects collection.
Let's take a look at the example VBA code.
To understand the chart object model.
The worksheet object Sheet 1 contains a chart objects collection.
The chart objects collection contains all the chart objects on that worksheet.
Individual chart objects can be referred to from the chart objects collection, either using their index number, the number relating to the order the charts were created, or the chart name.
This must be stated in quotation marks.
An embedded chart name is shown in the name box in Excel when the embedded chart is selected.
The chart property of chart objects returns the specific chart object.
And lastly, in this example, the has title property of the chart object is set to true to create a default title object.