Excel - Excel Macro Using "Like" comparison

Asked By jswalsh3 on 12-Mar-09 09:52 PM
I have found it convenient to use a macro code such as - If Cells(x, 3) Like
SS = True Then Check = "True"- where SS is - SS = Range("E12") & "*".

I find that this comparison is case sensitive, which is inconvenient for my
purposes. Is there a way of making this process insensitive to case with this
macro code or some other code?

Jim Walsh




JLGWhi replied on 12-Mar-09 10:49 PM
Make the comparison in the same case like this:

If LCase(Cells(x, 3).Value) Like "ss = true" Then Check = "True"
- where SS is - SS = Range("E12") & "*"
JLGWhiz replied on 12-Mar-09 10:55 PM
Disregard the last one, I hit post in error.
JLGWhi replied on 12-Mar-09 10:54 PM
"jswalsh33" wrote:
Jim Cone replied on 12-Mar-09 11:07 PM
You can also use the "Option Compare" statement at the top of the module
to force a case-insensitive comparison: Option Compare Text
--
Jim Cone
Portland, Oregon  USA



I have found it convenient to use a macro code such as - If Cells(x, 3) Like
SS = True Then Check = "True"- where SS is - SS = Range("E12") & "*".

I find that this comparison is case sensitive, which is inconvenient for my
purposes. Is there a way of making this process insensitive to case with this
macro code or some other code?
Jim Walsh
Tim Zych replied on 13-Mar-09 01:23 AM
I don't follow your example, but in general I like converting to upper case
for case insensitive comparison.

If UCase(s1) Like UCase(s2) Then...


--
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility
Free and Pro versions