ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing the value of chart labels (https://www.excelbanter.com/excel-programming/375939-changing-value-chart-labels.html)

juliejg1

Changing the value of chart labels
 
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?


Jim Cone

Changing the value of chart labels
 
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).DataLabe l.Text = _
"[" & ActiveChart.SeriesCollection(3).Points(N).DataLabe l.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"
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?


juliejg1

Changing the value of chart labels
 
Thanks Jim. I'll give it a try!

"Jim Cone" wrote:

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).DataLabe l.Text = _
"[" & ActiveChart.SeriesCollection(3).Points(N).DataLabe l.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"
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?




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

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