Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
comparing name
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
comparing name
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 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
comparing | Excel Discussion (Misc queries) | |||
comparing | Excel Worksheet Functions | |||
Comparing more than two | Excel Worksheet Functions | |||
Comparing | Excel Programming | |||
Comparing | Excel Programming |