Looping Through Chart Labels

  • Thread starter Thread starter Dan Gesshel
  • Start date Start date
D

Dan Gesshel

Hello.

I am trying to write a loop (such as a For...Next or Do Until) to loop
through all the Datalabels in a chart, evaluate whether they are below 3%
value, and if so to remove the labels.

There is only one SeriesCollection with multiple points (about 50.)

I have written this code before to success, but using a Range to check for
the value and not in a loop. Anyone out there help me or point me in the
right direction? I appreciate the help.

Thanks

Dan
 
Here is some starting code for you.

Dim DL As DataLabel

ActiveChart.ApplyDataLabels ShowValue:=True

For Each DL In ActiveChart.SeriesCollection(1).DataLabels
If CDbl(Left(DL.Text, Len(DL.Text) - 1)) < 3 Then
DL.Delete
End If
Next


Chrissy.
 
Here's a non-vba solution. Double click on the labels to format them,
click on the Number tab, and assign a custom number format like this one:

[<0.03]"";0%

- Jon
 
Back
Top