Case Specific

K

kirkm

? instr("enough tables and Chairs to seat 236", "chairs")

This returns 0 because I'm not using a capital "C" in chairs

Is there a command to cause Excel to be non case-specific ?

Thanks - Kirk
 
P

Per Jessen

Try this:

instr(LCase("enough tables and Chairs to seat 236"), "chairs")

Hopes this heps.
 
J

Jacob Skaria

Convert the text string and search string to the same case and then use Instr.

Lcase() for lower case
Ucase() for upper case

If this post helps click Yes
 
M

Mike H

Jacob,

You don't need to do that with instr, you can use the optional switch of 1
(VBTextCompare) and it ignores case. If you use the switch you have to
specify the other optional start character.

Mike
 
R

Rick Rothstein

Actually, I like using the built-in constant names rather than their
numerical equivalents (I find that makes the code more self-documenting)...

InStr(1, "enough tables and Chairs to seat 236", "chairs", vbTextCompare)
 
Top