Find cells that contain text
You have your arguments reversed... InStr is not the syntax equivalent of
the FIND function... the string you want to search is the first argument and
the substring you want to find is the second argument. However, InStr has an
optional first argument (yeah, that is strange, but that is how the function
works) and optional fourth argument as well, so you should check out the
help files for InStr so you can see how to use all of its parts.
--
Rick (MVP - Excel)
"AMH" wrote in message
...
Hi, as part of a loop I am trying to find cells that contain a string and
then copy some adjacent cells into another sheet. I can do the copy part
no
problem but I am struggling with finding the string, I am using the InStr
command but not sure if I ma making this to complicated, this is code I am
struggling with :
If InStr(string, Cells(bb, 65)) = 1 Then
With string being the string I am searching for and bb being the row
number
and part of the loop
The formula will recognise a complete string, but not part of string i.e.
String = abcd_
Cell contains abcd_ match and I can copy data
If cell contains abcd_efg no match and I want to take data from this row
I hope this makes sense and someone can help me
Thanks
|