Find method

N

nk

Is this posible to get a row number(when the value 2 was find) with a
Find metod in code:
With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With

Thanks'
 
B

Bob Phillips

Yes, it will be c.Row

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
D

Don Guillett

If you only need to find the first instance then this will work.

Sub find2()
MsgBox Columns(1).Find(2, lookat:=xlWhole).Row
End Sub
 

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

Top