Changing the value of chart labels

G

Guest

I have a stacked column chart based on data as follows:
2005 Exchange Volume Inflation Price
Blank 1,862 1,844 1,844 2,210
Up 0 93 0 402 0
Down 0 111 0 36

The 'Down' values are actually negative amounts but have to be shown as
positives for the chart to work properly. My question is, I woulld like the
lables in the chart for the 'Down' values to be put in brackets to represent
negative numbers. However, since the values have to be positive for this
chart to function properly, simply changing the formatting on the cells will
not work. Is there code I can write for this chart to show any values higher
than zero to be put in brackets?
 
J

Jim Cone

Here is some code that should be close to what you want...

Sub ChartLabelTest()
Dim lngCount As Long
Dim N As Long
lngCount = ActiveChart.SeriesCollection(3).Points.Count
For N = 1 To lngCount
ActiveChart.SeriesCollection(3).Points(N).DataLabel.Text = _
"[" & ActiveChart.SeriesCollection(3).Points(N).DataLabel.Text & "]"
Next 'N
End Sub
-----------

Or you could try out the free Excel add-in "Chart Data Labels",
as it can place formatted linked values from worksheet cells as the
text in your data labels.
Download from ... http://www.realezsites.com/bus/primitivesoftware
No registration required.

Jim Cone
San Francisco, USA


"juliejg1" <[email protected]>
wrote in message
I have a stacked column chart based on data as follows:
2005 Exchange Volume Inflation Price
Blank 1,862 1,844 1,844 2,210
Up 0 93 0 402 0
Down 0 111 0 36

The 'Down' values are actually negative amounts but have to be shown as
positives for the chart to work properly. My question is, I woulld like the
lables in the chart for the 'Down' values to be put in brackets to represent
negative numbers. However, since the values have to be positive for this
chart to function properly, simply changing the formatting on the cells will
not work. Is there code I can write for this chart to show any values higher
than zero to be put in brackets?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top