I have a macro which draw bunch of charts for me.
What I'd like to do is dynamically change color
of Data series
. I use RGB
color palete and function .ForeColor.RGB
.
When I use it directly .ForeColor.RGB = RGB(88, 88, 88)
- everything works fine. But When I try to take color
from a cell
.ForeColor.RGB = Sheets(1).Cells(1, 1)
I got an error Type missmatch
.
In Cell(1,1)
I have value: RGB(0, 0, 0)
.
How to pick color
for Data series
from cell
?
Macro and Excel window below.
Sub Macro1()
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.FullSeriesCollection(1).Select
MsgBox Sheets(1).Cells(1, 1)
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = Sheets(1).Cells(1, 1)
'.ForeColor.RGB = RGB(88, 88, 88)
.Transparency = 0
.Solid
End With
End Sub