Connecting Tech Pros Worldwide Forums | Help | Site Map

How to remove chart legend

Bon
Guest
 
Posts: n/a
#1: Mar 11 '06
Hello guys

Could anyone give me some hints on writng vba code for deleting legend
with zero value.
My chart is just shown percents There is a legend shown on the right
hand size.

I used the following lines to remove a pie chart with zero percent.

Set objChart = Me.oleLatestGraph.Object

For Each X In objChart.SeriesCollection(1).Points
'Use the following line for charts with just percents
If InStr(X.DataLabel.Text, "0%") > 0 Then
X.DataLabel.Delete
Else
With X.DataLabel.Font
..Size = "8"
..name = "Arial"
End With
End If
Next

Thanks in advance

Cheers
Bon


Closed Thread