ApplyDataLabels method (Excel Graph)

The ApplyDataLabels method as it applies to the Chart, Point, and Series objects.

Chart object

Applies data labels to a point, a series, or all the series in a chart.

Syntax

expression.ApplyDataLabels (Type, LegendKey, AutoText, HasLeaderLines)

expression Required. An expression that returns a Chart object.

Parameters

Name Required/Optional Data type Description
Type Optional XlDataLabelsType The data label type. Can be one of the XlDataLabelsType constants.
LegendKey Optional Variant True to show the legend key next to the point. The default value is False.
AutoText Optional Variant True if the object automatically generates appropriate text based on content.
HasLeaderLines Optional Variant True if the series has leader lines.

Point and Series objects

Applies data labels to a point, a series, or all the series in a chart.

Syntax

expression.ApplyDataLabels (Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression Required. An expression that returns a Point or Series object.

Parameters

Name Required/Optional Data type Description
Type Optional XlDataLabelsType The data label type. Can be one of the XlDataLabelsType constants.
LegendKey Optional Variant True to show the legend key next to the point. The default value is False.
AutoText Optional Variant True if the object automatically generates appropriate text based on content.
HasLeaderLines Optional Variant True if the series has leader lines.
ShowSeriesName Optional Variant The series name for the data label.
ShowCategoryName Optional Variant The category name for the data label.
ShowValue Optional Variant The value for the data label.
ShowPercentage Optional Variant The percentage for the data label.
ShowBubbleSize Optional Variant The bubble size for the data label.
Separator Optional Variant The separator for the data label.

Example

This example applies category labels to series one.

myChart.SeriesCollection(1). _ 
 ApplyDataLabels Type:=xlDataLabelsShowLabel

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.