ApplyDataLabels Method

Microsoft Excel Visual Basic

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

expression    Required. An expression that returns one of the objects in the Applies To list.

Type   Optional XlDataLabelsType. The type of data label to apply.

XlDataLabelsType can be one of these XlDataLabelsType constants.
xlDataLabelsShowBubbleSizes
xlDataLabelsShowLabelAndPercent. Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.
xlDataLabelsShowPercent. Percentage of the total. Available only for pie charts and doughnut charts.
xlDataLabelsShowLabel. Category for the point.
xlDataLabelsShowNone. No data labels.
xlDataLabelsShowValue. default. Value for the point (assumed if this argument isn't specified).

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. For the Chart and Series objects, 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 in Chart1.

Charts("Chart1").SeriesCollection(1). _
    ApplyDataLabels Type:=xlDataLabelsShowLabel