Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can someone tell me why If statement below equates to True? I really need to
know how the computer reads this expression. I thought the computer reads it from left to right, like this: True Or False = TRUE Then TRUE And False = False but, the computer says I'm wrong, why? How should I read this If Statement? If True Or False And False Then msgbox "Do Something" End If -- Cheers, Ryan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is always best to use parethesis to make sure calcuations are done in the
order you want. See VBA Help under PRECEDENCE for full explaination. Basically the AND is done before the OR so you have True Or (False And False) True or False True "RyanH" wrote: Can someone tell me why If statement below equates to True? I really need to know how the computer reads this expression. I thought the computer reads it from left to right, like this: True Or False = TRUE Then TRUE And False = False but, the computer says I'm wrong, why? How should I read this If Statement? If True Or False And False Then msgbox "Do Something" End If -- Cheers, Ryan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thats what I needed. Thanks!
-- Cheers, Ryan "Joel" wrote: It is always best to use parethesis to make sure calcuations are done in the order you want. See VBA Help under PRECEDENCE for full explaination. Basically the AND is done before the OR so you have True Or (False And False) True or False True "RyanH" wrote: Can someone tell me why If statement below equates to True? I really need to know how the computer reads this expression. I thought the computer reads it from left to right, like this: True Or False = TRUE Then TRUE And False = False but, the computer says I'm wrong, why? How should I read this If Statement? If True Or False And False Then msgbox "Do Something" End If -- Cheers, Ryan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
combining operators | Excel Programming | |||
Operators/if etc | Excel Programming | |||
Where are Bitwise Operators | Excel Worksheet Functions | |||
Operators With Times | Excel Discussion (Misc queries) | |||
Unary operators | Excel Worksheet Functions |