View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default select case simplification request

I doubt there is an advantage using either approach other than readability.
I tend to like more compact code, so I don't really like a long string of
Case statements (although I will admit they are easier for most people to
read)... my approach was to sum up the True/False results from the logical
comparisons of the dInp variable against the various range limits for it.
Just so you know, True in the VBA world equates to negative one (-1) and NOT
plus one (+1) like it does in worksheet formulas... this is why I have minus
signs in front of all my logical expressions... it turns the minus ones from
the True logical expressions to plus values (minus a minus value is a plus
value... it's like multiplying minus one times the minus value, which is
also minus one in the case of True... minus one times zero is still zero).
Anyway, if it is easier for you to see what is going on using the string of
Case statements, then that may be the way you should go... your choice, of
course.

--
Rick (MVP - Excel)



"dan dungan" wrote in message
...
Hi Rick,

Thank you, rick. Your code works, as well.

I'm not sure which code to use.

Is there some advantage to either approach?

thanks again,

Dan