Hello,
I have a conditional formatting issue, using VBA.
My conditional formatting code works fine for one column; however, when I try to apply the conditional formatting to two columns, the code only applies to the first column listed. Additionally, I have two sets of "rules" that apply to the same column. One of the "rules" includes two columns. The other rule applies to only one column. I'm not sure if this is my issue, or whether I'm trying to apply the same code to two different columns.
My code is below.
Code that applies to column "M" only...
Sub ADVERSE_ConditionalFormat_Rule_1
Sheets("Report").Select
Range("M8:M10000").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=if(N8<>"""",if(N8<>""n/a"",$N8>3))"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub
Code that applies to two columns, including column "M"...
Sub ADVERSE_ConditionalFormat_Rule_3_4
Sheets("Report").Select
Range("F8:F10000, M8:M10000").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=OR(AND(O8<>""n/a"",O8>2,$F8=""Denied"",P8="""",AJ8=""""),AND(O8<>""n/a"",O8>60,$F8=""Approved"",P8="""",AJ8=""""))"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.Color = -16776961
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub
Thanks in advance for any advice to solve my problem!
Bookmarks