Vba - graph color same as cell color

[Closed]
Report
Posts
1
Registration date
Sunday September 22, 2013
Status
Member
Last seen
September 22, 2013
-
Posts
2779
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
July 29, 2021
-
hi,
i am creating a project of my own using ms excel 2007 and i need help on this. i want to put the cell color to the graph that i am making using vba code. how the source cell that i'm getting the color was in 'conditional formatting'.

i'm currently using this code however it wont copy the color of the source cell unless i manually do it.

Sub ColorCharts()
For Each ch In ActiveSheet.ChartObjects
For Each ser In ch.Chart.SeriesCollection
s = Split(ser.Formula, ",")
For i = 1 To UBound(ser.Values)
ser.Points(i).Interior.Color = Range(s(2)).Cells(i).Interior.Color
Next i
Next ser
Next ch
End Sub


help please,

thank you

1 reply

Posts
2779
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
July 29, 2021
468
Hi,

I guess you have to use code instead of conditional formatting to solve your issue.

Best regards,
Trowa

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!