Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Excel : VBA Macro to make all series in a chart the same color (RGB)

Reaching out to the knowledge base.

Can someone point me to an Excel Macro that would color all the series (lines) in a specific (selected/current) chart the same color?

I have started the following, but it does nothing:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  Sub Same_Color()
 Dim Chart As Chart
 Dim Series As Series

 Set Chart = ActiveChart
 Set Series = Chart.SeriesCollection(2)

 Series.Format.Line.ForeColor.RGB = RGB(0, 255, 0)

End Sub

Thanks in advance

>Solution :

is it this what you need?

Sub InsertChartAndFormat()
 Dim cht As ChartObject

 Set cht = Sheet1.ChartObjects.Add(Left:=10, Width:=500, Top:=50, Height:=300)

 With cht
 .Chart.SetSourceData Source:=Sheet1.Range("A1:L2")
 .Chart.ChartType = xlBarClustered
 .Chart.SeriesCollection(1).Format.Fill.ForeColor.RGB = rgbAqua
End With

End Sub

BR
Bernd

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading