Thanks:  0
Likes:  0
Dislikes:  0

# Thread: If N = 4 or 5 and If C = 0 Then

1. ## If N = 4 or 5 and If C = 0 Then

How to correctly code

If N = 4 or 5 and If C = 0 Then

Can I use,

If N = (4 or 5) and C = 0 Then

or only

If N = 4 or 5 Then
If C = 0 Then
?

thx

2. ## Re: If N = 4 or 5 and If C = 0 Then

If N = 4 or N= 5 and C = 0 Then

msgbox "N=4"

end if

3. ## Re: If N = 4 or 5 and If C = 0 Then

I was thinking I might need to bracket the N as either 4 or 5 are good values for N but C must be 0 for both N Values.

thx, giving this a try

Continued:

Nope, as I tought. Once C = 1, the If statement still ran. Oops

so, no go.

4. ## Re: If N = 4 or 5 and If C = 0 Then

http://en.wikipedia.org/wiki/Order_o...ming_languages

Yes, AND is processed before OR by the order of operations so you need parens.

If (N = 4 or N= 5) and C = 0

5. ## Re: If N = 4 or 5 and If C = 0 Then

That's right, parentheses is missing from that post.

If (N = 4 or N= 5) and C = 0 Then

msgbox "N=4 and C=0"

end if

6. ## Re: If N = 4 or 5 and If C = 0 Then

Thx for confirming.

;-)

7. ## Re: If N = 4 or 5 and If C = 0 Then

perfect, thx

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.