but the limitation could be easily overcome with
res = Sin(x) + Log(x / 2) + Sqr(25.6) + Tan(3.2)
Yes. That's true. Select Case is just another way to do it. One advantage
to Case is that it does not require a variable, and the result of the
calculation is internal.
I may be wrong, but are you sure about
Case Is >= 5 And Sin(x) + Log(x / 2) + Sqr(25.6) + Tan(3.2) <= 10
"Is >= 5 " gets the left hand side from the internal results. There is
nothing further calculated. This part returns True, and the remaining
longer calculation is not performed. I could have sworn this generated an
error long ago, but it doesn't in Excel XP.
Looked at another way. Here we use "Or" instead of "And." Here, we do not
get the correct msgbox because Is <3 is False, and the remaining part (7>5)
is not used (It's a calculation).
Hope I said this correctly. :>)
Sub TestCase()
Dim x
x = 7
Select Case x * 1
Case Is < 3 Or 7 * 1 > 5 ' Or use x > 5
MsgBox "Between 5 and 10"
Case Else
MsgBox "This is not correct"
End Select
End Sub