Colors and charts


Posted by Johan on October 24, 2001 3:03 AM

We are trying to set the 'default' colors for 'Chart fills' with 12 different colors. This seems to be very difficult - we only can set 8 colors and in a very odd way.
Any suggestion of an solution in VBA?



Posted by Jonathan on October 24, 2001 7:10 PM

I was trying to get a grayscale chart and this is the code that worked. Obviously you will want to experiment with different ColorIndex#'s, and yuo may want to use a Mod 12 to repeat every 12 slices. HTH

ActiveChart.SeriesCollection(1).Select

For myPoint = 1 To ActiveChart.SeriesCollection(1).Points.Count

Select Case myPoint Mod 5
Case 0
myColorIndex = 56
Case 1
myColorIndex = 16
Case 2
myColorIndex = 48
Case 3
myColorIndex = 15
Case 4
myColorIndex = 2
End Select

With ActiveChart.SeriesCollection(1).Points(myPoint).Interior
.ColorIndex = myColorIndex
.Pattern = xlSolid
End With
Next myPoint