Class ChartCategory (Excel VBA)

Specifies a chart type's category.

Item

To use a ChartCategory class variable it first needs to be instantiated, for example

Dim chrc as ChartCategory
Set chrc = ActiveChart.ChartGroups(1).CategoryCollection(Index:=1)

ChartCategory class variables can be set using the CategoryCollection.Item procedure.

For Each

Here is an example of processing the ChartCategory items in a collection.

Dim chrcCategoryCollection As ChartCategory
For Each chrcCategoryCollection In ActiveChart.ChartGroups(1).CategoryCollection()
	
Next chrcCategoryCollection

CategoryCollection.Count

Returns a Long value that represents the number of objects in the CategoryCollection (returns the number of categories visible in the chart).

Dim lngCount As Long
lngCount = ActiveChart.ChartGroups(1).CategoryCollection.Count

CategoryCollection.Item

Returns a single object from the CategoryCollection object.

Item (Index)

Index: The index number for the object.

Dim chrcCategoryCollection As ChartCategory
Set chrcCategoryCollection = ActiveChart.ChartGroups(1).CategoryCollection(Index:=1)

IsFiltered

Returns True when the user filters out a series.

When a series is transferred out of its parent SeriesCollection, that series still remains in its parent FullSeriesCollection. When a user filters the series back in, it is inserted back in its original place in the SeriesCollection.

ActiveChart.ChartGroups(1).CategoryCollection(1).IsFiltered = True

Name

Returns a String value that represents the name of the object.

Dim strName As String
strName = ActiveChart.ChartGroups(1).CategoryCollection(1).Name