Using wildcard in VBA comparison? need a hint please.
You can't use a wildcard in an equality comparison. You can look at the
Like operator
if Myrange.Value like "*" then
? "dog" like "*"
True
? "a$@Afsldkf" like "*"
True
not sure how that is a savings over
v1 = "All"
but you seem to be fixated on it.
--
Regards,
Tom Ogilvy
"KR" wrote in message
...
The proposed solution of multiple statements did work; the one that I'm
still curious about (wildcards) I never got working- I tried replacing the
string of "All" with the string of "*" (if V1 = "All" then V1 = "*") but
when I used statements like:
If MyRange1 = V1 then 'etc.
where MyRange1 = "dog" and now my V1 = "*", it was comparing the actual
strings - which aren't equal - instead of somehow incorporating the "*" as
a
wildcard. I suspect there is some syntax specific to the use of wildcards
that I didn't find in my search of the help file. I'll keep looking...
:)
Thanks,
Keith
"Tom Ogilvy" wrote in message
...
All isn't a wildcard, so you would still have to recognize that the
selection is All. If you are going to determine that, then it would be
redundant to try to use a wildcard.
|