78 thoughts on “Automatically Set Chart Series Colors to Match Source Cell Colors”

Is it possible to color code the table portion of a bar graph. I am trying to accomplish having ie. Jan-Jun one color then Jul-Dec another color. This would be the table that is incorporated within the graph. Thanks.

Thanks for this – most useful 🙂
It does reset the chart type to “lines with blobs” – but that’s easy to undo.
A related thing – mentioned often in the comments, is a means to link to the conditional formatting colours. I think what is really wanted here is a way to define cell colour based on numbers, so you can get a rainbow or a 2-colour fade.
Can we have a macro that takes three cells with RGB numbers and colours the 4th cell in said column to the RGB value specified? this can then be the title row in the macro offered here.
BTW – I seem to need to colour both the title row and the first data, to be sure the graph picks-up the right colours.

Actually, doing the conditional formating by vba is totally feasible. But the macro takes the colour of the first cell of each serie and apply it to the whole serie. How would you modify the code so that it takes into account the colour of each individual cell of each serie?

Hi. This macro SAVED ME! I am doing color analisys on a Thesys about colors on Comics. Well, I needed to have the colours ina chart, according to the percentage they appeared in the pages – and voilá your macro saved my chart!!!
Thank you!

How can I get the labels to be the same colors as the text in the cell it’s coming from? The colors are using conditional formatting so if it’s yellow background it would be Black text, if it’s red background it should be white text.

I have the same issue as tim and joe. This would be extra powerful if we could color each data point in the series… I’m trying to figure out the syntax for the extra “For” loop required… will revert if i do but could use help

This is awesome and works on Excel 2013. I know nothing about VBA and it worked great on a scatter plot. Two things for other newbies.

1. There is a circle that is getting inserted before the word Chart…you will need to delete that in several places
2. If your worksheet has a comma in the name, it will not work. OP, is there any way to fix this?

Hello
I am a very begginner with macro…
I have data organised by categories and years and a total on all years
In my spread sheet I have both a cumulated area chart (to show the distribution of categories accross years) and a pie chart to show the total distribution.
The orginal macro works fine for the cumulated area chart (but colors the pie chart with only 1 color which is logic as there is only 1 category), and the 2nd macro from chris, then works fine on the pie chart and has no effect on the cumulated area chart.
Therefore by running the 2 macro (1st then 2nd) I have the result I want but would it be possible to have only macro that would do it at the same time?
Many thanks