Re: Syntax for "and" and "or"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
>


.



Relevant Pages

  • Re: Compact Fluorescent Noise
    ... the X10 switch and the lighting string to isolate all CFs on that circuit. ... We do have one circuit isolated by the large 20A XPF filter. ...
    (comp.home.automation)
  • Re: Compact Fluorescent Noise
    ... the X10 switch and the lighting string to isolate all CFs on that circuit. ... We do have one circuit isolated by the large 20A XPF filter. ... is on the non X10 phase, and feeds most electronic devices, computers, etc. ...
    (comp.home.automation)
  • Re: Programming a PIC in a 3V system.
    ... > I am trying to design a circuit, so I can program the PIC in circuit. ... If you cannot use a low voltage programming PIC then you need to isolate the ... PIC Vcc from the 3.3V system with a diode and use a pull up on Vpp to PIC ... And yes the PIC16F876A does support low voltage programming. ...
    (comp.arch.embedded)
  • Re: Need help please! Two PLCs to sense the state of one bank of switches
    ... The outputs are used to instruct a PLC. ... > make another PLC aware of the state of these switches. ... > need to have relays to isolate the PLCs. ... > circuit design for this application. ...
    (sci.electronics.design)