I have the following:
If current = temp then
End if
My problem is the following:
Current = Apple
temp = APPLE
How can I compare these two strings without the case involved. I want the
if statement to treat them as equal.
Thank,
Eric Sabo
I have the following:
If current = temp then
End if
My problem is the following:
Current = Apple
temp = APPLE
How can I compare these two strings without the case involved. I want the
if statement to treat them as equal.
Thank,
Eric Sabo
Hi Eric,
Try:
If LCase(current) = LCase(temp) then
---
Regards,
Norman
"Sabo, Eric" <[email protected]> wrote in message
news:[email protected]...
>I have the following:
>
> If current = temp then
>
> End if
>
>
> My problem is the following:
>
> Current = Apple
> temp = APPLE
>
> How can I compare these two strings without the case involved. I want
> the if statement to treat them as equal.
>
> Thank,
> Eric Sabo
>
>
Hi Eric I think this should work
If StrComp(temp, Current, vbTextCompare) = 0 Then
'Your Code in here
End If
regards,
Tim
Hi Eric I think this should work
If StrComp(temp, Current, vbTextCompare) = 0 Then
'Your Code in here
End If
regards,
Tim
if strcomp(Current,Temp,1) = 0 then
or
if ucase(Current) = Ucase(Temp) then
--
Regards,
Tom Ogilvy
"Sabo, Eric" <[email protected]> wrote in message
news:[email protected]...
> I have the following:
>
> If current = temp then
>
> End if
>
>
> My problem is the following:
>
> Current = Apple
> temp = APPLE
>
> How can I compare these two strings without the case involved. I want
the
> if statement to treat them as equal.
>
> Thank,
> Eric Sabo
>
>
>
There's a setting that you can use that makes text comparisons case insensitive.
Add
Option Compare Text
Right at the top of the module--outside any procedure.
Then you can just compare:
if current = temp then
If case never matters for any procedure in that module, it's an easy fix.
"Sabo, Eric" wrote:
>
> I have the following:
>
> If current = temp then
>
> End if
>
> My problem is the following:
>
> Current = Apple
> temp = APPLE
>
> How can I compare these two strings without the case involved. I want the
> if statement to treat them as equal.
>
> Thank,
> Eric Sabo
--
Dave Peterson
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks