LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Best/Easiest way to search/find in a string

Hi Joel,

'-----------------
You have to consider if the CASE makes a difference in you text. You may
want to force all text to uppercase before you do a comparison. Instr is
case sensitive, while using "=" is not case sensitive.
'-----------------

Try:

'=============
Public Sub Tester()
Dim iPos As Long
Dim jPos As Long
Const sStr As String = "A CAT AND A DOG"
Const sStr2 As String = "cat"

iPos = InStr(1, sStr, sStr2, vbTextCompare)
jPos = InStr(1, sStr, sStr2, vbBinaryCompare)

MsgBox Prompt:="vbTextCompa " & iPos _
& vbNewLine _
& "vbBinaryCompare : " & jPos
End Sub
'<<=============


---
Regards,
Norman




 
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
Find specific info using search string using VBA laavista Excel Discussion (Misc queries) 5 May 20th 09 07:59 PM
Easiest way to find differences between Rows? Jonathan Excel Discussion (Misc queries) 3 February 20th 09 08:51 PM
Search/Match/Find ANY part of string to ANY part of Cell Value TWhizTom Excel Worksheet Functions 0 July 21st 08 08:16 PM
FIND / SEARCH text compare cell to string in 3rd cell nastech Excel Discussion (Misc queries) 0 October 29th 07 02:51 AM
search a string withing a string : find / search hangs itarnak[_9_] Excel Programming 4 October 24th 05 03:19 PM


All times are GMT +1. The time now is 12:55 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"