Assuming you're using Excel, Visual Basic for Applications (VBA).
1. Make the test string uppercase, then use UCASE:
Mystr = "D2"
If UCase(Left(h, Len(myStr))) = myStr Then
2. Or use StrComp(String1,String2, Type) which returns 0 (zero) if the two
strings match. The comparison is not case-sensitive when Type is set to 1.
If StrComp(Left(h, Len(myStr)), myStr, 1) = 0 Then
3. Or put this statement at the module level to declare the default comparison
method to be case-insensitive:
Option Compare Text
Quote:>How do I format this command so that when it looks at the cell, it will
>recognize both lower case and uper case.
>Mystr = "D2"
>If Left(h, Len(myStr)) = myStr Then
>This if loop looks at a string, lets say "D2" and does something to it.
>However if the cell reads "d2", it ignores it. Can
>someone hlep format this statement so that it recognizes both "d2" and "D2"