Solved VBA Conditional formatting

Leo_Polla_Psemata

Registered User.
Local time
Yesterday, 20:09
Joined
Mar 24, 2014
Messages
364
Code:
        With .Range("J10:J" & i).FormatConditions.Add(xlCellValue, xlEqual, "=""F""")

         .Interior.Color = RGB(150, 150, 50)
        
        End With

Hi there,
the above code works just fine.
However, my goal is to apply format on the condition that the field is NOT equal to "P" or "C"
I tried xlNotEqual , it doesn't like it
 
See section on using formula https://support.microsoft.com/en-us/office/use-conditional-formatting-to-highlight-information-fed60dfa-1d3f-4e13-9ecb-f1951ff89d7f?ui=en-us&rs=en-us&ad=us#:~:text=1 Select the data that you want to,to apply and click OK . See More

Used Macro Recorder to generate code using a selection from A1 to E1, modify as needed for your situation:

.FormatConditions.Add Type:=xlExpression, Formula1:= "=AND(IF(A1<>""p"",1),IF(A1<>""c"",1))"
 

Users who are viewing this thread

Back
Top Bottom