Search option

G

Guest

Hi,

I have the following situation:
I have 1 worksheet(Employees) with all the last names(Column A), First names
(Column B), phonenumbers (Column C) and location (Column D) of the employees.
I created 2 userforms with the fields Firstname, Last name and Phonenumber.
1 Userform (Searchform) where users can enter for example the first name of
the employee and press the button search.
Now the second form (Resultform) has to pop up with the First name, Last
name and phonenumber of the employee. What code is needed for this?
So what i want is to create a telephome book programm with excel.
I have searched most of the topics in this database but i can't find this.

Can somehelp me?

Thanks!
 
B

Bob Phillips

Something like

On Error Resume Next
iPos = Application.Match(txtLastname, Range("A:A"), 0)
On Error GoTo 0
If iPos > 0 Then
MsgBox Cells(iPos, "A").Value & ", " & _
Cells(iPos, "B").Value & ", " & _
Cells(iPos, "C").Value & ", " & _
Cells(iPos, "B").Value
End If

--

HTH

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

Guest

Hi Bob,

Thanks for the answer, but i can't get it working: Let me explain it again:

I have two userforms
The search userform opens when the excel sheet opens. Here you can enter the
first name (or lastname) of a person and press on the search button: Now the
second userform (resultform) has to open and the first name, lastname,
phonenumber and location of this person appears in textboxes.
All the data is stored in 1 worksheet. Can you help me again?

Thanks!

"Bob Phillips" schreef:
 

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