View Single Post
  #3   Report Post  
Jon Peltier
 
Posts: n/a
Default

I have a codeless alternative. Use two dummy series, one for positive
data labels, one for negative. Make these XY series, so you can control
their position precisely where you want the labels; both series have
points in exactly the same locations. Hide the series by formatting them
with no markers and no lines. Along with the data for the two series,
you have data for two set of labels. Use formulas, so one set appears
when the value is = zero, and the other set appears when the value is <
zero. use a third party add-in like:

Rob Bovey's Chart Labeler, http://appspro.com
John Walkenbach's Chart Tools, http://j-walk.com/ss

to apply the positive labels to one dummy series and the negatives to
the other. These add-ins link to the labels by formulas, so when the
cells show and hide values, so do the labels. Format the positive labels
with the green scheme, and the negatives with the red.

This is very similar to the conditional charting examples on my web page:

http://peltiertech.com/Excel/Charts/...nalChart1.html

I've even used it to help position some labels above the points and
others below, to avoid having to move them manually. It's fully
automatic, without having to run a macro, or rely on one to run after
some event.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


Karl wrote:

Hello,
We have a Excel 2003 worksheet named 'OBQI 2004' that has multiple
embedded column charts.

Here is the source data for one of the charts:

F G H

85 (Prior) (Current)
86 MO700 32% 32%
87 MO690 40% 41%
88 MO420 53% 52%
89 No Prior Data 37%
90 MO670 56% 55%
91 MO780 34% 33%
92 No Prior Data 50%
93 No Prior Data 57%

So the data range value is: ='OBQI 2004'!$F$85:$H$93

Each chart has two series:

Series 1
Name: ='OBQI 2004'!$G$85
Values: ='OBQI 2004'!$G$86:$G$93

Series 2
Name: ='OBQI 2004'!$H$85
Values: ='OBQI 2004'!$H$86:$H$93

For each chart the datalabels for series 1 has been removed.

The datalabels for series 2 has been positioned at the bottom of each
column.

ok... here's the question.

I need to format each series 2 datalabel to have a white background and
red font if the value of Column H(Current) - Column G(Prior) is less
than 0. Otherwise, the datalabel is formated with a green background
with a black font.

This is currently a manual process that I would like to automate.

Can this be done in VBA? Can someone please provide me with or point me
to an example?

TIA

Karl