Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Does VBA shortcut "or" statements?

Thanks.

***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Does VBA shortcut "or" statements?

Explain the question

Regards,
Peter T

wrote in message
...
Thanks.

***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does VBA shortcut "or" statements?

No... in expressions containing logical operators (And, Or, Xor, etc.), VB
evaluates every sub-expression even if the first one's evaluation would be
enough to determine the expression's value as a whole.

Rick


wrote in message
...
Thanks.

***


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Does VBA shortcut "or" statements?

Explain the question

Shortcutting in this context means that, for example, the right operand of
an OR operation is not evaluated if the left operand is True. Logically,
shortcutting makes sense, because if the left operand is True, there is no
need to evaluate the right operand since the OR is True regardless of the
value of the right operand.

No, VB/VBA does not shortcut operations.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Peter T" <peter_t@discussions wrote in message
...
Explain the question

Regards,
Peter T

wrote in message
...
Thanks.

***




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Does VBA shortcut "or" statements?

I kind of suspected that was what the OP meant but didn't want to second
guess a reply.

Although logically it might seem as though evaluating the right operand is
redundant if the left is true, I assume it always evaluates both as Or works
by doing a Bitwise comparison of the pair.

v = -1 Or -1
v = -1 Or True
v = True Or 0
the above all return -1 but the following returns True.
v = True Or True

Regards,
Peter T

"Chip Pearson" wrote in message
...
Explain the question


Shortcutting in this context means that, for example, the right operand of
an OR operation is not evaluated if the left operand is True. Logically,
shortcutting makes sense, because if the left operand is True, there is no
need to evaluate the right operand since the OR is True regardless of the
value of the right operand.

No, VB/VBA does not shortcut operations.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Peter T" <peter_t@discussions wrote in message
...
Explain the question

Regards,
Peter T

wrote in message

...
Thanks.

***






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shortcut to switch from "fill down" to "copy" with mouse drag RJ Dake Excel Discussion (Misc queries) 3 August 13th 09 05:35 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
keyboard shortcut to return to previous cell after "find" or "got. Nadavb New Users to Excel 1 May 25th 08 01:39 AM
Need more than 7 nested "IF" statements in Excel" James A Excel Discussion (Misc queries) 1 December 17th 06 02:02 AM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"