Class DataLabel (Excel VBA)

The class DataLabel represents the data label on a chart point or trendline.

The classes Point and Trendline. give access to class DataLabel

Member in collection

Item

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

Dim dtl as DataLabel
Set dtl = ActiveCell.Width(1).DataLabel

The following procedures can be used to set variables of type DataLabel: DataLabels.Item, Point.DataLabel and Trendline.DataLabel.

For Each

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

Dim dtl As DataLabel
For Each dtl In ActiveCell.Width.DataLabels()
	
Next dtl

Delete - Deletes the object.

Select - Selects the object.

DataLabels.Delete - Deletes the object.

DataLabels.Item - Returns a single object from a collection.

DataLabels.Propagate - Enables you to take the contents and formatting of a single data label and apply it to every other data label in the series.

DataLabels.Select - Selects the object.

Properties

AutoText true if the object automatically generates appropriate text based on context.

Caption returns or sets a String value that represents the data label text.

Characters returns a Characters object that represents a range of characters within the object text. You can use the Characters object to format characters within a text string.

Format returns the ChartFormat object.

Formula gets or sets a String value that represents the formula of the object using A1-style notation, in English.

FormulaLocal gets or sets a String value that represents the formula of the object using A1-style notation, in the language of the user.

FormulaR1C1 gets or sets a String value that represents the formula of the object using R1C1-style notation, in English.

FormulaR1C1Local gets or sets a String value that represents the formula of the object using R1C1-style notation, in the language of the user.

Height returns the height of the object in points.

HorizontalAlignment returns or sets a value that represents the horizontal alignment for the specified object.

Left returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Name returns a String value that represents the name of the object.

NumberFormat returns or sets a String value that represents the format code for the object.

NumberFormatLinked true if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells).

NumberFormatLocal returns or sets a value that represents the format code for the object as a string in the language of the user.

Orientation returns or sets a value that represents the text orientation.

Position returns or sets an XlDataLabelPosition value that represents the position of the data label.

ReadingOrder returns or sets the reading order for the specified object. Can be one of the following XlReadingOrder constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext.

Separator sets or returns a Variant representing the separator used for the data labels on a chart.

Shadow returns or sets a Boolean value that determines if the object has a shadow.

ShowBubbleSize true to show the bubble size for the data labels on a chart. False to hide.

ShowCategoryName true to display the category name for the data labels on a chart. False to hide.

ShowLegendKey true if the data label legend key is visible.

ShowPercentage true to display the percentage value for the data labels on a chart. False to hide.

ShowRange used to toggle the Range field if it exists on the data label range.

ShowSeriesName returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide.

ShowValue returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide.

Text returns or sets the text for the specified object.

Top returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

VerticalAlignment returns or sets a value that represents the vertical alignment of the specified object.

Width returns the width of the object in points.

DataLabels.AutoText true if the object automatically generates appropriate text based on context.

DataLabels.Count returns a Long value that represents the number of objects in the collection.

DataLabels.Format returns the ChartFormat object.

DataLabels.HorizontalAlignment returns or sets a value that represents the horizontal alignment for the specified object.

DataLabels.Name returns a String value that represents the name of the object.

DataLabels.NumberFormat returns or sets a String value that represents the format code for the object.

DataLabels.NumberFormatLinked true if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells).

DataLabels.NumberFormatLocal returns or sets a value that represents the format code for the object as a string in the language of the user.

DataLabels.Orientation returns or sets a value that represents the text orientation.

DataLabels.Position returns or sets an XlDataLabelPosition value that represents the position of the data label.

DataLabels.ReadingOrder returns or sets the reading order for the specified object. Can be one of the following XlReadingOrder constants: xlRTL (right-to-left), xlLTR (left-to-right), or xlContext.

DataLabels.Separator sets or returns a Variant representing the separator used for the data labels on a chart.

DataLabels.Shadow returns or sets a Boolean value that determines if the object has a shadow.

DataLabels.ShowBubbleSize true to show the bubble size for the data labels on a chart. False to hide.

DataLabels.ShowCategoryName true to display the category name for the data labels on a chart. False to hide.

DataLabels.ShowLegendKey true if the data label legend key is visible.

DataLabels.ShowPercentage true to display the percentage value for the data labels on a chart. False to hide.

DataLabels.ShowRange used to toggle the Range field if it exists on the data label range.

DataLabels.ShowSeriesName returns or sets a Boolean to indicate the series name display behavior for the data labels on a chart. True to show the series name. False to hide.

DataLabels.ShowValue returns or sets a Boolean corresponding to a specified chart's data label values display behavior. True displays the values. False to hide.

DataLabels.VerticalAlignment returns or sets a value that represents the vertical alignment of the specified object.

Characters - Represents characters in an object that contains text.

ChartFormat - Provides access to the Office Art formatting for chart elements.