#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Runtime

Does anyone know the difference in runtime and memory usage for
IF..Then..Else and a Switch statement in VBA, when the two are equivalent
expressions? Thank you.

Brent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Runtime

This is a synopsis, but not necessarily complete.

Runtime is while the code is executing.

Memory usage is the storage required to compile
and execute a procedure.
'
If..Then..Else sets a condition which if met, or
not met will result in some response, or lack of
response as determined by the user, with the
Else occuring when the first condition does not
apply.'

The Switch function provides a facility to use
different definitions for the same variable and
match the definitions modifier for each switch.'

I don't know that you could say any two are
equivalent, but you could conceivably get a similar
result using Switch in place of an If...Then.

For more information, refer to the VBA help files.

"Brent" wrote:

Does anyone know the difference in runtime and memory usage for
IF..Then..Else and a Switch statement in VBA, when the two are equivalent
expressions? Thank you.

Brent

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Runtime

P.S. If you meant the difference in time and/or the
difference in amount. I don't know.

"Brent" wrote:

Does anyone know the difference in runtime and memory usage for
IF..Then..Else and a Switch statement in VBA, when the two are equivalent
expressions? Thank you.

Brent

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Runtime


All of the expressions in a Switch or IIF statement are evaluated whether or not
they are true. An If/Then or Select case statement stops evaluation with the
first condition that is True. Draw your own conclusion.

I tend to favor the Select Case statement for more than 3 conditions.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Brent"
wrote in message
Does anyone know the difference in runtime and memory usage for
IF..Then..Else and a Switch statement in VBA, when the two are equivalent
expressions? Thank you.

Brent
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
Runtime Sundowner Excel Discussion (Misc queries) 0 February 27th 10 01:31 AM
Runtime error Anthony[_5_] Excel Discussion (Misc queries) 5 December 10th 09 05:14 AM
Runtime 429 JeffMelton Excel Programming 1 July 23rd 06 08:48 PM
Runtime error 91 help hachiroku Excel Programming 2 May 16th 06 02:20 AM
Runtime Error mangesh_yadav[_137_] Excel Programming 0 October 13th 04 12:06 PM


All times are GMT +1. The time now is 02:19 AM.

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"