Thread: Find next
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Frank Frank is offline
external usenet poster
 
Posts: 170
Default Find next

Hi,

I have created an option to search for a name in a userform and after you
press search a new userform opens which shows the result. So far it works
fine. On the second userform i have a button called Next result. I want to
show the next result but i can't figure it out. Can some one have a look at
this?

The code used for the search option:

Private Sub Zoekbtn_Click()
If Searchform.firstname = "" Then

msgbox "Enter a value"
Else
Call firstnamesearch
Resultform.Show
End If
End Sub

Private Sub firstnamesearch()

With Worksheets("Employees").Range("a2:a500")
Set f = .Find(Firstname, LookIn:=xlValues)
If Not c Is Nothing Then 'Firstname found .....
' Get data from this row i.e. containing firstname
r = f.Row
Resultform.Firstname = Cells(r, "A")
Resultform.Lastname = Cells(r, "B")
Resultform.Phonenumber = Cells(r, "C")
Resultform.Mobile = Cells(r, "D")
Resultform.Location = Cells(r, "E")


Else
msgbox "No data found"

End If
End With
End Sub