View Single Post
  #1  
Old March 8th, 2004, 10:02 PM
Jon Peltier
external usenet poster
 
Posts: n/a
Default Conditional Pie Chart Formatting (Color)

I don't think KB noticed you were working with a Pie chart.

Here's the kind of macro you need. The X values of the plotted series is
the column of division names, and the Y values are the pie wedge sizes.
In the code below, change the dummy labels "AAAA" etc to your division
labels, and change the ColorIndex values to the colors you want.

Sub ColorWedges()
Dim iPoint As Long, nPoint As Long
With ActiveChart.SeriesCollection(1)
For iPoint = 1 To .Points.Count
Select Case WorksheetFunction.Index(.XValues, iPoint)
Case "AAAA"
.Points(iPoint).Interior.ColorIndex = 6 ' Yellow
Case "BBBB"
.Points(iPoint).Interior.ColorIndex = 5 ' Blue
Case "CCCC"
.Points(iPoint).Interior.ColorIndex = 3 ' Red
Case "DDDD"
.Points(iPoint).Interior.ColorIndex = 13 ' Purple
Case "EEEE"
.Points(iPoint).Interior.ColorIndex = 46 ' Orange
Case "FFFF"
.Points(iPoint).Interior.ColorIndex = 4 ' Green
Case "GGGG"
.Points(iPoint).Interior.ColorIndex = 8 ' Cyan
End Select
Next
End With
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______


Tim Gardner wrote:

Thanks KBBrown. However, I'm still not getting it. I separated the
data into 4 columns and then made each of the 4 a series within 1 pie
chart. I was thinking that I could then individually highlight each
of the 4 series and manually change the slice fill color. However,
the pie chart seems only to display the first listed series. Maybe I
misunderstood your advice?