View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Having "Or" in If statements in VB doesn't work?

It isn't, at least for me:

Dim a As Long
Dim b As Long

a = 0
b = 0
If a = 2 Or b = 2 Then MsgBox "a: " & a & " b: " & b
a = 2
b = 0
If a = 2 Or b = 2 Then MsgBox "a: " & a & " b: " & b
a = 0
b = 2
If a = 2 Or b = 2 Then MsgBox "a: " & a & " b: " & b



In article ,
J@Y wrote:

I was trying this statement:

If a = 2 or b =2 then .....

But the b = 2 doesn't get tested for some reason, why is that?