DataLabels Method

Applies To

Series Object.

Description

Accessor. Returns an object that represents a single data label (a DataLabel object, Syntax 1) or a collection of all data labels for the series (a DataLabels collection, Syntax 2).

Syntax 1

object.DataLabels(index)

Syntax 2

object.DataLabels

object

Required. The Series object.

index

Required for Syntax 1. The number of the data label.

Remarks

If the series has the Show Value option on for the data labels, the returned collection can contain up to one label for each point. Data labels can be turned on or off for individual points in the series.

If the series is on an area chart and has the Show Label option on for the data labels, the returned collection contains only a single label, which is the label for the area series.

See Also

DataLabel Property.

Example

This example sets the data labels for series one in Chart1 to show their key, assuming that their values are showing when the example runs.


With Charts("Chart1").SeriesCollection(1)
    .HasDataLabels = True
    With .DataLabels
        .ShowLegendKey = True
        .Type = xlValue
    End With
End With