Bar graph w/ no value (#N/A)

  • Thread starter Thread starter Aimee
  • Start date Start date
A

Aimee

I am creating a graph using bars and would like to include
the values on the bar. However, if the value is #N/A, an
extraneous "#N/A" is displayed on the graph. Is there any
way to suppress this?
 
Aimee -

This macro removes #N/A and zero from the datalabels in the active chart:

Sub OutNA()
Dim mySrs As Series
Dim myPt As Point
Dim myLbl As DataLabel
Dim iPtIx As Integer
Dim iPtCt As Integer
For Each mySrs In ActiveChart.SeriesCollection
iPtCt = mySrs.Points.Count
For iPtIx = iPtCt To 1 Step -1
If mySrs.DataLabels(iPtIx).Text = "#N/A" Then
mySrs.DataLabels(iPtIx).Text = ""
ElseIf mySrs.Values(iPtIx) = 0 Then
mySrs.DataLabels(iPtIx).Text = ""
End If
Next
Next
End Sub

- Jon
 
Back
Top