View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Hinojosa via OfficeKB.com Hinojosa via OfficeKB.com is offline
external usenet poster
 
Posts: 28
Default using find method after using it earlier

when your'e using this Find command is there a way to copy what your looking
for plus the eight cells next to the word?

Tom Ogilvy wrote:
I can't see you code, but it could be that you don't set all the options or
you could be searching after the activecell and that isn't located where you
think.

Sub SubFindIt()
sStr = "ABC"
Set rng = Cells.Find(What:=sStr, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
MsgBox sStr & " found at " & rng.Address
Else
MsgBox sStr & " not found"
End If
End Sub

would be a good way to do the search. Obviously, consult the help on find
and adjust the arguments to meet your needs.

Also, I assume you are using Find and not FindNext. You wouldn't want to
use findnext if you are changing what you are searching for.

I use the find method to find a cell. I copy the contents of the
cells. Later I use the find method to find a different string. At
this point it find the first string or sometimes gives me an error that
object not found. Any ideas. Is there a way to clear a register hold
the first string?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200610/1