Thread: Select Case
View Single Post
  #17   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default Select Case

(Disregard my previous post; a wrong editing keystroke posted it before I
was ready!)

<<What is the correct programming instead of "Case Is < 2"?

In this case, I guess you have to use the Is operator (the VBA editor will
add it automatically for you if you leave it out). Or, if this is a simple
case, maybe an If statement would work (i.e. If x < 2 Then ... ).

<<The time lost on the few occasions when it bites me is nothing compared
to the time "wasted" with the declarations.

I guess I have to disagree with this one. I was "bitten" early on in my VBA
learning experience by typos and spelling errors, so have been declaring
all variables ever since. Declarations also give me a place to put a
comment to further explain what the variable stands for. As you can see
from the replies that I post in this newsgroup, I tend to use long variable
names (i.e. ilngNumRows, instead of just i or j) even for short demo
routines, as I just can't figure out the algorithms when single-letter
names are used. Auto List Members fills in the variable names for me fairly
quickly most of the time. I spend relatively little time in the debugger
trying to figure out errors. I do this even for short demo routines in this
newsgroup because I hope that there are a few people that want to see the
proper way to write VBA code.

I do enjoy reading your posts, however, and like learning faster ways of
programming from the people here who are much more advanced than I.
--
Regards,
Bill Renaud