detriez
Board Regular
- Joined
- Sep 13, 2011
- Messages
- 193
- Office Version
- 365
- Platform
- Windows
With help from the forum I got this conditional formatting work.
I need to move it to VBA but, it fails at "MQL" with Compile error: Expected End of statement
Code:
=IFERROR(VLOOKUP(H2,'Standard Values'!D:G,4,0)="MQL",FALSE)
I need to move it to VBA but, it fails at "MQL" with Compile error: Expected End of statement
VBA Code:
Range("H2:H250000").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(H2<>"""",=IFERROR(VLOOKUP(H2,'Standard Values'!D:G,4,0)="MQL",FALSE)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = vbBlue
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False