'How to make all series in a chart the same color?
How do I color all the series (lines) in a specific (selected/current) chart the same color?
I have the following, but it does nothing:
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
Solution 1:[1]
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
Solution 2:[2]
Never Mind Solved it:
Sub Same_Color() Dim Chart As Chart Dim Series As Series
Set Chart = ActiveChart Set Series = Chart.SeriesCollection(2)
For Each Series In Chart.SeriesCollection
Series.Format.Line.ForeColor.RGB = RGB(0, 255, 0)
Next
End Sub
Here's one for making all the series the same thickness:
Sub Change_all_charts()
Dim sht As Worksheet
Dim ChtObj As ChartObject
Dim srs As Series
For Each sht In Worksheets
For Each ChtObj In sht.ChartObjects
For Each srs In ChtObj.Chart.SeriesCollection
srs.Format.Line.Weight = 1
Next
Next
Next
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user18083442 |
Solution 2 | Jeff Porfirio |