user2703472
user2703472

Reputation: 45

VBA , Why this if condition doesn't work?

This is my condition

If Range("calcu") = "Orifice diameter" Or Range("calcu") = "Perforated area" And Range("oridia").Value < Range("gasinp").Value Then

if i remove Or Range("calcu") = "Perforated area" then it works but together with OR & AND , it does not work.

Why ?

Upvotes: 0

Views: 1131

Answers (1)

mucio
mucio

Reputation: 7119

Parenthesis, the last frontier.

I think you were looking for this:

If (Range("calcu") = "Orifice diameter" Or Range("calcu") = "Perforated area") _
   And Range("oridia").Value < Range("gasinp").Value Then

Upvotes: 4

Related Questions