butters149
New Member
- Joined
- Mar 21, 2018
- Messages
- 23
Hello,
I am trying to modify my VBA to do multiple conditional formatting but it doesn't seem to work. Below is the code and the two outcomes I like. Can anyone please help? Thank you.
1.) Highlight range of row cells if column R is more than 60
AND
2.) Highlight range of row cells if column R and L meet criteria of $R2>45,$L2>100000
Range("E2:R2").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$R2>60"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND($R2>45,$L2>100000)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("A1").Select
I am trying to modify my VBA to do multiple conditional formatting but it doesn't seem to work. Below is the code and the two outcomes I like. Can anyone please help? Thank you.
1.) Highlight range of row cells if column R is more than 60
AND
2.) Highlight range of row cells if column R and L meet criteria of $R2>45,$L2>100000
Range("E2:R2").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$R2>60"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND($R2>45,$L2>100000)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("A1").Select