Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can I compare two text strings and ignore case without using Regular
Expressions? Is there a regular VBA text function I can use? If IgnoreCase(Array1(0)) = IgnoreCase(Array2(0)) then 'Do something End if Thanks EM |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If UCase(Array1(0)) = UCase(Array2(0)) then
or If LCase(Array1(0)) = LCase(Array2(0)) then Regards, Bernd |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use lcase():
if lcase(array1(0)) = lcase(array2(0)) then or use ucase() Or you could use if strcomp(array1(0),array2(0),vbTextCompare) = 0 then Or you could force every string comparison to be case-insensitive by adding a line to the top of the module: Option Compare Text ExcelMonkey wrote: Can I compare two text strings and ignore case without using Regular Expressions? Is there a regular VBA text function I can use? If IgnoreCase(Array1(0)) = IgnoreCase(Array2(0)) then 'Do something End if Thanks EM -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Use the StrComp function and specify text (case insensitive) comparison: If StrComp(Array1(0), Array2(0), vbTextCompare) = 0 Then ' equal Else ' not equal End If Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Mon, 25 May 2009 14:28:01 -0700, ExcelMonkey wrote: Can I compare two text strings and ignore case without using Regular Expressions? Is there a regular VBA text function I can use? If IgnoreCase(Array1(0)) = IgnoreCase(Array2(0)) then 'Do something End if Thanks EM |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank-you!
EM "Dave Peterson" wrote: You can use lcase(): if lcase(array1(0)) = lcase(array2(0)) then or use ucase() Or you could use if strcomp(array1(0),array2(0),vbTextCompare) = 0 then Or you could force every string comparison to be case-insensitive by adding a line to the top of the module: Option Compare Text ExcelMonkey wrote: Can I compare two text strings and ignore case without using Regular Expressions? Is there a regular VBA text function I can use? If IgnoreCase(Array1(0)) = IgnoreCase(Array2(0)) then 'Do something End if Thanks EM -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Get rid of with regular expressions | Excel Discussion (Misc queries) | |||
Regular expressions | Excel Programming | |||
Using Regular Expressions with VBA | Excel Programming | |||
Regular expressions | Excel Programming | |||
Regular Expressions in VBA? | Excel Programming |