ChartGroups collection (Excel Graph)
A collection of all the ChartGroup objects in the specified chart. Each ChartGroup object represents one or more series plotted with the same format in a chart.
A chart contains one or more chart groups, each chart group contains one or more series, and each series contains one or more points. For example, a single chart might contain both a line chart group, containing all the series plotted with the line chart format, and a bar chart group, containing all the series plotted with the bar chart format.
Remarks
Use the ChartGroups method to return the ChartGroups collection.
Use ChartGroups (index), where index is the chart group's index number, to return a single ChartGroup object.
Because the index number for a particular chart group can change if the chart format used for that group is changed, it may be easier to use one of the named chart-group shortcut methods to return a particular chart group. The PieGroups method returns the collection of pie chart groups in the specified chart, the LineGroups method returns the collection of line chart groups, and so on. Each of these methods can be used with an index number to return a single ChartGroup object, or used without an index number to return a ChartGroups collection.
Methods
Example
The following example displays the number of chart groups in the chart.
MsgBox myChart.ChartGroups.Count
The following example adds drop lines to chart group one in the chart.
myChart.ChartGroups(1).HasDropLines = True
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.