Sub ConditionalFormatting() Dim MyRange As Range 'Create range object Set MyRange = Range("A2:x10999") 'Delete previous conditional formats MyRange.FormatConditions.Delete 'Add LATE rule MyRange.FormatConditions.Add Type:=xlTextString, TextOperator:=xlContains, _ String:="LATE" MyRange.FormatConditions(1).Interior.Color = vbRed 'Add RISK rule MyRange.FormatConditions.Add Type:=xlTextString, TextOperator:=xlContains, _ String:="RISK" MyRange.FormatConditions(2).Interior.Color = RGB(255, 153, 0) 'Add WATCH rule MyRange.FormatConditions.Add Type:=xlTextString, TextOperator:=xlContains, _ String:="WATCH" MyRange.FormatConditions(3).Interior.Color = vbYellow End Sub
MyRange.FormatConditions(1).Row.Interior.Color = vbRed
MyRange.FormatConditions(1).EntireRow.Interior.Color = vbRed
MyRange.FormatConditions.Add Type:=xlExpression, Formula1:="=$J2=""LATE"""
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)