共用方式為


DataLabels.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 DataLabels 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.

Sub ChangeSeparator() 
 
 ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1) _ 
 .DataLabels.Separator = ";" 
 
End Sub

請參閱

概念

DataLabels Object Members

DataLabels Object