Capturing Row of Selection.Find?

  • Thread starter Thread starter Hash
  • Start date Start date
H

Hash

Gang -

How do I capture the row of a successful Selection.Find?

I did find out that Selection.Find returns -1. What's that mean?

And how would I do this without making a selection? The macro recorder
doesn't help there. I ended up using a "For each cell" loop looking for
an equality and incrementing/capturing a counter.


Thanks in advance.

....best, Michael
 
rowno = Selection.Find("123").Row

I posted this to a previous posting from you!
 
Using Toppers approach is fine if you are guaranteed that the target value
will be found. If not, it is better to set a reference to the result of the
find command and then test if Find was successful

Dim rng as Range
set rng = Columns("C").Find("123")
if not rng is nothing then
rw = rng.row
Else
msgbox "123 not found"
exit sub
End if
 
Tom -

Thank you. Toppers message never made it to my news server, but I see
the way to go.

Thanks again.
....Hash
 

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