Update line chart series colors
Hi,
I have a combination bar and line chart. I need to update the chart color based on the color stored at sheet1. However, i just manage to update the bar color but the macro seem not working for the line.
Here is the code
Sub UpdateColours()
Dim MyArray As Range 'The Worksheet with colour selections
Dim MyColour As Object 'object in range
Dim iSeries As Long
Dim rSeries As Range
'YOU MUST CUSTOMISE THIS NEXT SECTION: CHECK THE CH AND TBL SHEET NAMES
Set MyArray = Sheets("Sheet1").Range("L2:L20")
Application.ScreenUpdating = False
With ActiveChart
Do While k < .SeriesCollection.Count
k = k + 1
For Each MyColour In MyArray
If .SeriesCollection(k).Name = "VOL - " & MyColour Then
.SeriesCollection(k).Interior.Color = MyColour.Interior.Color
ElseIf .SeriesCollection(k).Name = "AVG - " & MyColor Then
.SeriesCollection(k).Interior.Color = MyColour.Interior.Color
End If
Next
Loop
End With
Application.ScreenUpdating = True
End Sub
Last edited by Apple Ling : November 2nd 10 at 06:50 AM
|