Sub ColorByYear2()
Dim iPoint As Long, nPoint As Long
Dim sCategory As String
With ActiveChart.SeriesCollection(1)
For iPoint = 1 To .Points.Count
sCategory = WorksheetFunction.Index(.XValues, iPoint)
If InStr(sCategory, "2001") Then
.Points(iPoint).Interior.ColorIndex = 6 ' Yellow
ElseIf InStr(sCategory, "2002") Then
.Points(iPoint).Interior.ColorIndex = 5 ' Blue
ElseIf InStr(sCategory, "2003") Then
.Points(iPoint).Interior.ColorIndex = 3 ' Red
ElseIf InStr(sCategory, "2004") Then
.Points(iPoint).Interior.ColorIndex = 13 ' Purple
ElseIf InStr(sCategory, "2005") Then
.Points(iPoint).Interior.ColorIndex = 46 ' Orange
ElseIf InStr(sCategory, "2006") Then
.Points(iPoint).Interior.ColorIndex = 4 ' Green
Else
.Points(iPoint).Interior.ColorIndex = 8 ' Cyan
End If
Next
End With
End Sub