Hello Dear community,
I want to know is there a way to make my chart series color dynamic?
So let's say A2:T2 are cells with different colors.
I want My Series 1 to change it is color based on cell A2 color
My Series 2 to change it is color based on cell B2 color and so on
I tried this code. But it fills all series with single color
I want to know is there a way to make my chart series color dynamic?
So let's say A2:T2 are cells with different colors.
I want My Series 1 to change it is color based on cell A2 color
My Series 2 to change it is color based on cell B2 color and so on
I tried this code. But it fills all series with single color
VBA Code:
Sub ColorAllItems()
Dim chrt As Chart
Set chrt = Sheet1.ChartObjects(1).Chart
'We grab the color of the A1 on sheet 1
' then convert the color to RGB which is required for charts
clr = Sheet1.Cells(1, 1).Interior.Color
r = clr Mod 256
g = clr \ 256 Mod 256
b = clr \ 65536 Mod 256
'The loop below loops through the all Axis points
For c = 1 To chrt.SeriesCollection(1).Points.Count
chrt.SeriesCollection(1).Points(c).Format.Fill.ForeColor.RGB = RGB(r, g, b)
Next
End Sub