View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ABS ABS is offline
external usenet poster
 
Posts: 6
Default Hiding 0 value data labels in chart

On Apr 15, 11:41*am, septimus wrote:
I have an Excel column chart with data labels that show values which
are numbers between 1.0 and 5.0 (rounded to one decimal point). There
are a number of blank values in the data table used to produce the
chart, and they are being charted as "0.0". Apart from the fact that
this is ugly, it doesn't really even make sense with this data.

So how can I keep the desired data labels (1.0 - 5.0) and hide the
0.0s? It's been suggested to me that I could force #N/As and then
Excel wouldn't graph those values. But when I try that, I either end
up with stubborn 0.0s or, worse yet, data labels that say "#N/A".

Is there VBA solution here? A way to loop through the labels and hide
the values, maybe?

Thanks for your help.


sept,
Try pasting this code into a code module in your workbook, go back to
the worksheet, make sure you select the chart and take
macrovanishzerolabelsrun.

Sub VanishZeroLabels()
For x = 1 To ActiveChart.SeriesCollection(1).Points.Count
If
ActiveChart.SeriesCollection(1).Points(x).DataLabe l.Text = "0.0" Then

ActiveChart.SeriesCollection(1).Points(x).DataLabe l.Delete
End If
Next x
End Sub

Hope this helps,
ABS