DataLabel.Separator property (Excel)

Sets or returns a Variant representing the separator used for the data labels on a chart. Read/write.

Syntax

expression.Separator

expression A variable that represents a DataLabel object.

Remarks

If you use a string, you'll get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1) (see the XlDataLabelSeparator enumeration), you'll get the default data label separator, which is either a comma or a newline, depending on the data label.

When a value of "1" is returned, it indicates that the user has not changed the default separator, which is a comma ",". You can also pass a value of "1" to change the separator back to the default separator.

The chart must first be active before you can access the data labels programmatically; otherwise, a run-time error occurs.

Example

This example sets the data label separator for the first series on the first chart to a semicolon. This example assumes that a chart exists on the active worksheet.

Sub ChangeSeparator() 
 
 ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1) _ 
 .DataLabels.Separator = ";" 
 
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.