PC Review


Reply
Thread Tools Rate Thread

comparing name

 
 
Abhinandan
Guest
Posts: n/a
 
      19th Feb 2009
Sub test()

Dim name As String

name = InputBox("Please write your name below")

If name = "xyz" Then
MsgBox "matches"
Else
MsgBox "does not match"
End If

End Sub

Hi,

In the above progarm, when I type xyz in the input box, the name matches.
However, when I type XYZ, the name does not match. Irrespctive of whether I
type XYZ or xyz, the name should match. Can please someone point me in the
right direction.

Thanks,
Abhi

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      19th Feb 2009

Try

If StrComp(Name, "xyz", vbTextCompare) = 0 Then
' match
Else
' no match
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 Thu, 19 Feb 2009 08:38:07 -0800, Abhinandan
<(E-Mail Removed)> wrote:

>Sub test()
>
> Dim name As String
>
> name = InputBox("Please write your name below")
>
> If name = "xyz" Then
> MsgBox "matches"
> Else
> MsgBox "does not match"
> End If
>
>End Sub
>
>Hi,
>
>In the above progarm, when I type xyz in the input box, the name matches.
>However, when I type XYZ, the name does not match. Irrespctive of whether I
>type XYZ or xyz, the name should match. Can please someone point me in the
>right direction.
>
>Thanks,
>Abhi

 
Reply With Quote
 
Abhinandan
Guest
Posts: n/a
 
      19th Feb 2009
Hi this worked.
Thanks very much
Abhinandan

"Chip Pearson" wrote:

>
> Try
>
> If StrComp(Name, "xyz", vbTextCompare) = 0 Then
> ' match
> Else
> ' no match
> 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 Thu, 19 Feb 2009 08:38:07 -0800, Abhinandan
> <(E-Mail Removed)> wrote:
>
> >Sub test()
> >
> > Dim name As String
> >
> > name = InputBox("Please write your name below")
> >
> > If name = "xyz" Then
> > MsgBox "matches"
> > Else
> > MsgBox "does not match"
> > End If
> >
> >End Sub
> >
> >Hi,
> >
> >In the above progarm, when I type xyz in the input box, the name matches.
> >However, when I type XYZ, the name does not match. Irrespctive of whether I
> >type XYZ or xyz, the name should match. Can please someone point me in the
> >right direction.
> >
> >Thanks,
> >Abhi

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Striker3070 Microsoft Excel Programming 2 10th May 2010 04:00 PM
comparing pierre Microsoft Excel Misc 2 6th May 2010 06:02 AM
Comparing more than two Vern Microsoft Excel Worksheet Functions 4 24th Sep 2008 04:03 PM
comparing if a1>b1, then - b1 from a1 Bob Westaby Microsoft Excel Worksheet Functions 2 16th Apr 2004 03:08 PM
Comparing Bill Hand Microsoft Excel Misc 1 1st Aug 2003 02:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:13 AM.