How to change chart colors in VBA
I have to change the colors of a pie chart in VBA. I 'managed' to change the font color, which is not what I wanted, this way:
ActiveChart.Legend.开发者_JS百科LegendEntries(1).Border.ColorIndex = 6
I want to change the color of the actual piece of pie. I also have to set specific colors, which are part of the standard palette. The 6 above gives me a flashy yellow but I want the colors highlighted here
When faced with problems like this, I usually record a macro and examine what Excel does. I'd try this:
ActiveChart.SeriesCollection(1).Points(1).Interior.ColorIndex = 6
For colors, check out the RGB(red,green,blue)
function.
精彩评论