I am trying to delete all conditional formatting from a sheet, and add new formatting. I use the following macro (it's recorded) but when I run it, it gives me an error by .ThemeColor = xlThemeColorDark1 towards the end of the macro. The first conditional format highlights the cell yellow, and the second one changes the font to white.
Code:
Sub PLConditionalFormatting()
Cells.FormatConditions.Delete
Columns("L:L").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=A1=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Columns("F:L").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=B1=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub