ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macro Using "Like" comparison (https://www.excelbanter.com/excel-programming/425503-excel-macro-using-like-comparison.html)

jswalsh33

Excel Macro Using "Like" comparison
 
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

JLGWhiz

Excel Macro Using "Like" comparison
 
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") & "*"

"jswalsh33" wrote:

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


JLGWhiz

Excel Macro Using "Like" comparison
 

"jswalsh33" wrote:

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


JLGWhiz[_2_]

Excel Macro Using "Like" comparison
 
Disregard the last one, I hit post in error.


"JLGWhiz" wrote in message
...
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") & "*"

"jswalsh33" wrote:

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




Jim Cone[_2_]

Excel Macro Using "Like" comparison
 
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



"jswalsh33"
wrote in message
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

Excel Macro Using "Like" comparison
 
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


"jswalsh33" wrote in message
...
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





All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com