Microsoft Office Tutorials and References
In Depth Information
Figure 21-25. Illustrating the Add method: the data
To illustrate, consider the worksheet in Figure 21-25 .
Figure 21-25. Illustrating the Add method: the data
The following code will create the chart in Figure 21-26 :
Dim co As ChartObject
Set co = ActiveSheet.ChartObjects. _
Add(100, 100, 300, 200)
co.Chart.ChartType = xlColumnClustered
co.Chart.SeriesCollection.Add _
Source:=ActiveSheet.Range("A1:C7"), _
Rowcol:=xlColumns, SeriesLabels:=True, _
Categorylabels:=True
Note that the series labels are in the first row and the category labels are in the first column.
Figure 21-26. Illustrating the Add method: the chart
21.15.2 The DataLabel Object
A DataLabel object represents the data label of a chart data point (or trendline). (We discuss the
Point object later in the chapter.) Each Series object has a DataLabels collection that contains one
DataLabel object for each point in the series. The Data-Labels collection is returned by the
DataLabels method, as in:
If ActiveChart.SeriesCollection(1). _
HasDataLabels Then
MsgBox ActiveChart.SeriesCollection(1)._
DataLabels.Count
 
 
 
Search JabSto ::




Custom Search