DataLabel.ShowCategoryName property (Excel)

True to display the category name for the data labels on a chart. False to hide. Read/write Boolean.

Syntax

expression.ShowCategoryName

expression An expression that returns a DataLabel object.

Remarks

The chart must first be active before you can access the data labels programmatically, or a run-time error will occur.

Example

This example shows the category name for the data labels of the first series on the first chart. This example assumes that a chart exists on the active worksheet.

Sub UseCategoryName() 
 
 ActiveSheet.ChartObjects(1).Activate 
 ActiveChart.SeriesCollection(1) _ 
 .DataLabels.ShowCategoryName = True 
 
End Sub

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.