Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
comparing pierre Excel Discussion (Misc queries) 2 May 6th 10 06:02 AM
comparing Donna[_2_] Excel Worksheet Functions 3 November 3rd 09 01:45 AM
Comparing more than two Vern Excel Worksheet Functions 4 September 24th 08 04:03 PM
Comparing saman110 via OfficeKB.com Excel Programming 1 May 21st 08 09:33 PM
Comparing Kirk[_4_] Excel Programming 1 December 2nd 03 08:35 PM


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"