Share via


DataLabel.Separator Property

Excel Developer Reference

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 will get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1), you will 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 a chart exists on the active worksheet.

Visual Basic for Applications
  Sub ChangeSeparator()
ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1) _
    .DataLabels.<strong>Separator</strong> = ";"

End Sub

See Also