ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Search option (https://www.excelbanter.com/excel-programming/341331-search-option.html)

Frank

Search option
 
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!

Bob Phillips[_6_]

Search option
 
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)


"Frank" wrote in message
...
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!




Frank

Search option
 
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:

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)


"Frank" wrote in message
...
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!






All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com