Jakison Ojha
Jakison Ojha

Reputation: 11

how to format using formulas in vba

I have an excel sheet in which Column N cells/Range of cells need to be formatted by any interior color using the condition

AND(OR(ISBLANK(N1),N1>M2),E1=E2)

Kindly suggest how implement this in VBA. I tried to get this by recording macro, but not getting any code for this.

Thank you

Upvotes: 0

Views: 67

Answers (1)

Variatus
Variatus

Reputation: 14373

If Range("E1").Value = Range("E2").Value Then
    If (Len(Range("N1").Value) = 0) Or (Range("N1").Value > Range("M2").Value) Then
        MsgBox "The conditions have been met"
    End If
End If

Upvotes: 1

Related Questions