In the "If and If" condition i have variuos OR.
In order of speed time code wath is the best sultion from If And If or Case Select
IF AND IF OR SELECT CASE... wath the best solution
-
- PlatinumLounger
- Posts: 4481
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 79365
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: IF AND IF OR SELECT CASE... wath the best solution
I did some tests, but execution speed seems to be about the same. If you have a lot of consecutive single conditions, If is slightly faster, and if you have lots of multiple conditions with Or, Select Case is slightly faster, but the differences are very small.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12789
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: IF AND IF OR SELECT CASE... wath the best solution
I think that you should choose which to use based on readability of the code. This can make a very big difference in the long term and will be much more significant than tiny performance differences.
StuartR