Hi,
I have used someone else's macro which controls colors of all bar charts in worksheet, and it works fine. I now need to change some of the charts to stacked bar charts, i.e. add a field into the Legend, and also control colors of the different elements of the stacked bar.
e.g.
For bar called "Delivered", I have color fixed as 1213412. This works for first series in the stack (legend = "Match"), but second series ("No Match") shows as different color. This is fine but I want to control this color in the macro.
thanks.
Capture2.PNG
Sub Colors()
Dim Sht As Worksheet
Dim CurrentSheet As Worksheet
Dim ChtO As ChartObject
Dim ser As Series
Dim clf As ColorFormat
Dim j As Long
Set CurrentSheet = ActiveSheet
For Each Sht In ActiveWorkbook.Worksheets
For Each ChtO In Sht.ChartObjects
Set ser = ChtO.Chart.SeriesCollection(1)
For j = 1 To ser.Points.Count
Set clf = ser.Points(j).Format.Fill.ForeColor
Select Case ser.XValues(j)
Case "Delivered": clf.RGB = 1213412
etc....
End Select
Next j
Next ChtO
Next Sht
End Sub
Bookmarks