In Excel 2003, when I change Series.Interior.ColorIndex to a value I need, it has no effect. It has an effect only when I first manually change color and then run the macro. Apparently this triggers some update mechanism. Does anyone have an explanation for this? Is there a way to somehow trigger this in the chart?.. I.e. make sure that the color changes take effect.
In addition, when I step through the code and watch ColorIndex, it does not change even after value is assigned. Is this one of the many bugs in Excel?
The code looks like this:
Sub DoStuff() Dim j As Long For j = 1 To ActiveChart.SeriesCollection.Count With ActiveChart.SeriesCollection(j) Select Case ActiveChart.SeriesCollection(j).Name Case 'Milk' .Interior.ColorIndex = 4 Case 'Cookies' .Interior.ColorIndex = 28 Case 'Honey' .Interior.ColorIndex = 26 End Select End With Next j End Sub
Edit: I am working with bar chart.
Try setting the border as well.