ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping Through Chart Labels (https://www.excelbanter.com/excel-programming/273166-looping-through-chart-labels.html)

Dan Gesshel

Looping Through Chart Labels
 
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



Chrissy[_4_]

Looping Through Chart Labels
 
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.

"Dan Gesshel" wrote in message ...
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





Jon Peltier[_3_]

Looping Through Chart Labels
 
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
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Dan Gesshel wrote:
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





All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com