Multiple IF conditions-AND/OR

  • Thread starter Thread starter richzip
  • Start date Start date
R

richzip

Hello,

I have the following If/Then statement set up.

If (Cond1) and (Cond2) and (Cond3a) or (Cond3b) or (Cond3c) Then

I want the "then" to be fulfilled only if BOTH Conditions 1 AND 2, as well
as "at least one" of the # 3 conditions are true. How would I properly use
and/or combinations as well as parenthese/brackets?

I thought it might be something like this, but it didn't work:

If (Cond1) and (Cond2) and [(Cond 3a) or (Cond3b) or (Cond3c)] Then
 
Try

a = 1
b = 2
c = 5

If a = 1 And b = 2 And (c = 3 Or c = 4 Or c = 5) Then
MsgBox "Success"
End If
 
Try nested if statements:

If (Cond1) and (Cond2) Then
If (Cond3a) or (Cond3b) or (Cond3c) Then
...your code here
EndIf
EndIf

Hope that helps :)
 
Back
Top