Data Labels

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Hello,
Is there a way to determine how many data labels a series has? Thanks.

Bill
 
Hi Bill,

Try this routine.
The error trap should handle problems caused by missing or gaps in your
data plus the deletion of individual data labels within a series.

Sub x()
Dim intSeries As Integer
Dim intPoint As Integer
Dim intCountDataLabels As Integer

On Error GoTo ErrCount

With ActiveChart
For intSeries = 1 To .SeriesCollection.Count
With .SeriesCollection(intSeries)
If .HasDataLabels Then
intCountDataLabels = 0
For intPoint = 1 To .Points.Count
If .Points(intPoint).HasDataLabel Then
If Err.Number = 0 Then _
intCountDataLabels = intCountDataLabels + 1
End If
Next
MsgBox "Series " & intSeries & " has " & _
intCountDataLabels & " of out a possible " & .Points.Count
Else
MsgBox "Series " & intSeries & " has no data labels"
End If
End With
Next
End With

Exit Sub
ErrCount:
intCountDataLabels = intCountDataLabels - 1
Resume Next
End Sub

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top