Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default String Comparison using Like Problem

The code below is used in a search to find a row that matches a
person's name entered into a text box on a userform. I can't understand
why my like comparison isn't working:

Dim chkRequestor As String
Dim FindRequestor As String
Dim StrRequestor As String

chkRequestor = Me.txtFindRequestor.Value
StrRequestor = "*" & UCase(chkRequestor) & "*"
Requestor = Range("c" & rowindex).Value
FindRequestor = "*" & UCase(Requestor) & "*"

If StrRequestor Like FindRequestor Then
'Do commands
end if

The strrequestor value I'm using is "*SHELLEY*" and the FindRequestor
value is "*SHELLEY BOWMAN*"...why isn't this working???

Thanks,
Shelley

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default String Comparison using Like Problem

I forgot to add Dim Requestor as string, but it is already in my code.
Help is much appreciated!!

Shelley

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default String Comparison using Like Problem

Isn't your comparison backwards?

? "*SHELLEY BOWMAN*" like "*SHELLEY*"
True

works for me,

but you are doing

"*SHELLEY*" Like "*SHELLEY BOWMAN*"

testing:
? "*SHELLEY*" Like "*SHELLEY BOWMAN*"
False

If you actually want to find Shelley Bowman in Shelley, then a false result
would be correct.

--
Regards,
Tom Ogilvy


"sbowman" wrote:

I forgot to add Dim Requestor as string, but it is already in my code.
Help is much appreciated!!

Shelley


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default String Comparison using Like Problem

Thank You!!! Due to my overworked state, I am having "technical
difficulties" today :-)

Shelley

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
Comparison of alphanumeric string ErExcel Excel Discussion (Misc queries) 4 May 7th 07 02:14 PM
String Comparison & Conditional Formatting Blobbies Excel Discussion (Misc queries) 3 April 18th 06 07:43 AM
comparison string VBA excell stats Excel Discussion (Misc queries) 5 March 16th 06 10:12 PM
String Comparison Purnima Excel Programming 9 March 8th 05 11:13 AM
VB String Comparison In Excel Craig[_8_] Excel Programming 2 November 24th 03 07:47 PM


All times are GMT +1. The time now is 09:19 AM.

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

About Us

"It's about Microsoft Excel"