using find method after using it earlier

  • Thread starter Thread starter rub
  • Start date Start date
R

rub

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?
 
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.
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top