Search or FIND on a userform.

P

Patrick Molloy

Adding "SearchDirection" and "After" to the Find method
will help. For this the found cell needs to be
selected...actually not quite true, but with the code as
is...

Private Sub CommandButton48_Click()
'MsgBox TextBox86
If TextBox86 <> "" Then
Dim found As Range
With Worksheets("Master").Cells
If found Is Nothing Then Set found = Selection
Set found = .Find(TextBox86, after:=found,
LookIn:=xlValues, searchdirection:=xlNext)

If Not found Is Nothing Then
MsgBox TextBox86 & " Found!" & found.Address
found.Select
Else
MsgBox TextBox86 & " Not Found!"
End If
End With
Else

MsgBox "Search Criteria was empty..."

End If

End Sub


Patrick Molloy
Microsoft Excel MVP
 

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