select case question
The Select Case structure is not a direct equivalent of an If-Then block.
This line...
Select Case sStr
says to find a Case statement below which equals the contents of the sStr
variable. Presumably, sStr holds a String value of some kind. This Case
statement...
Case sStr Like "*" & var1 & "*"
is the same as this one (for your given conditions)...
Case True
Since the String contents of sStr is not equal to True, the code for this
Case statement is not executed.
Rick
"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
in A1 i have the text, "this is a test"
i try to use this select case statement
var1 = "test"
sStr = Range("A1").Value
Select Case sStr
Case sStr Like "*" & var1 & "*"
'do something here
the first case statement is skipped but if i break and hover the mouse
over it, says it equals true. if i go to the immediate window and type
?sStr Like "*" & var1 & "*"
TRUE
it returns true. so why does it skip to the next select case statement? if
it's the only select case statement, it exits the select case without
doing anything.
--
Gary
|