View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AndreasHermle AndreasHermle is offline
external usenet poster
 
Posts: 26
Default Check for the existence of data labels

Dear Experts:

below macro ...
.... deletes any data labels from all data series of all charts on the
active worksheet.

I wonder whether the macro could check at the beginning ...
.... for the existence of any data labels (1 to n) and if there are
none at all come up with a msgbox telling the user ('All data labels
have already been deleted!').

Help is much appreciated.Thank you very much in advance.

Regards, Andreas

Sub DataLabels_Remove()

Dim ChtObj As ChartObject
Dim i As Integer
Dim ser As Series
i = 0

For Each ChtObj In ActiveSheet.ChartObjects
With ChtObj.Chart
For Each ser In .SeriesCollection
ser.ApplyDataLabels (xlDataLabelsShowNone)
Next ser
End With
Next

End Sub