Thread: comparing name
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default comparing name


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
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