Hi Syed,
But "xlbo" is saying something different. What do you think?
It all depends on what you include in the comparisons. Take the seemingly equivalent code:
Select Case a
Case b
Case c
Case d
End Select
If a = b Then
ElseIf a = c Then
ElseIf a = d Then
End If
If a is a constant or a simple variable, a simple timing test shows that the If..ElseIf is faster. However, if a is an expression
to evaluate, that evaluation is done once in the Select Case and multiple times in the If..ElseIf, which will probably negate the
difference in speed between the two constructs.
Personally, I find Select case easier to read and prefer it, but as ever with performance tuning, the only solution is to test it
using your own code and data.
Regards
Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk