Re: Syntax for "and" and "or"
- From: "Bob Phillips" <bob.phillips@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 22 Jan 2006 16:17:42 -0000
The best way is to use brackets to isolate the conditions.
If (A And B) Or _
(C And D) And _
(E Or D) Then
'do you stuff
End If
Note though that VB does not short circuit when testing, which can cause
problems, which are invariably worse, more likey, harder to debug with such
conditions. This means that even if a condition is met that would cause the
overall test to fail, it still runs the other tests. If they could give rise
to errors, you will get the error even if that test is irrelevenat in a
particular case.
--
HTH
Bob Phillips
(remove nothere from the email address if mailing direct)
"knowtrump" <knowtrump.221nam_1137946201.2317@xxxxxxxxxxxxxxxxxxxxx> wrote
in message news:knowtrump.221nam_1137946201.2317@xxxxxxxxxxxxxxxxxxxxxxxx
>
> Can someone please show me the proper syntax for using "and" and "or"
> operators with "if" in a Macro? Can they be used together?
>
>
> --
> knowtrump
> ------------------------------------------------------------------------
> knowtrump's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=19664
> View this thread: http://www.excelforum.com/showthread.php?threadid=503802
>
.
- References:
- Syntax for "and" and "or"
- From: knowtrump
- Syntax for "and" and "or"
- Prev by Date: Re: Display Elapsed Time like a Stopwatch
- Next by Date: Dynamic Control addition and Event response
- Previous by thread: Syntax for "and" and "or"
- Next by thread: Dynamic Control addition and Event response
- Index(es):
Relevant Pages
|