View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Best/Easiest way to search/find in a string

If InStr(1, Source, "input_range", vbTextCompare) Then

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.


InStr has optional arguments... if you specify the optional starting point
for your search in the 1st argument, then an optional 4th argument is
available to take care of casing issues. In my statement above,
vbTextCompare forces a case insensitive search to take place (you can
specify vbBinaryCompare which forces an case sensitive search to take place,
but specifying it is unnecessary as it is the default condition for searches
when not specified).

Rick