First off I am new to the site and fairly new to VBA/Macros although far from new to programming in general. With that said I am having a bit of problems with the syntax. I am attempting to have conditional coloring on a chart based on whether it is after a particular date (horizontal axis 2009 or >). The range of these horizontal values is C11:C40 and the range of the data is J11:J40.
Here is my attempt thus far.. any help is much appreciated
Sub FormatChartColours()
Dim lngIndex As Long, rngData As Range, pt As Point, ser As Series, rngCell As Range
Set rngData = Worksheets("AL").Range("C11:C40")
Set ser = AL.ChartObjects("Chart 4").Chart.SeriesCollection(1)
With ser
.Interior.ColorIndex = 18
For lngIndex = 1 To .Points.Count
Set pt = .Points(lngIndex)
Set rngCell = rngData.Cells(lngIndex)
If rngCell.Interior.ColorIndex > 2009 Then
pt.Format.Fill.ForeColor.ObjectThemeColor = rngCell.Interior.ThemeColor
End If
Next lngIndex
End With
End Sub
Bookmarks