ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help finding data from userform (https://www.excelbanter.com/excel-programming/337637-help-finding-data-userform.html)

bballmama43

Help finding data from userform
 
I have been working no this problem for days. Let me start wtih saying
that I have already read Help, and have bought 2 books that I am
working with. This problem specifically is something I have a brain
block about. Any help is sincerely appreciated!

A very simple version of my spreadsheet is this:

A B C D E
Employee EmpNum CurrentPay Raise Yearly amount

I have created a UserForm with textboxes allow a user to enter cells A,
B, and C. It will create a new row at the end of my spreadsheet. E is
calculated from D and C.

What I want to do, and what I cannot do, is enter EmpNum (employee's
unique ID number) and have the fields updated on my UserForm. In other
words, I enter numbre 12345 and see that John Doe makes $30,000.00.
Then, I would like to enter John's raise into D.

I absolutely cannot figure out how to enter the number and show me the
remaining info from the row.

Any help out there for me? I have searched high and low for info on the
Find method and see that it is not as easy as I want it to be.

tia.
bballmama


Tom Ogilvy

Help finding data from userform
 
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim rng as Range, rng1 as Range, res as Variant
With Worksheets("Data")
set rng = .Range(.Range("B2"),.Range("B2").end(xldown))
End with
res = Application.Match(Textbox1.Text,Rng,0)
if not iserror(res) then
set rng1 = rng(res)
Textbox2.Text = rng.Offset(0,-1).Value ' Name, column A
Textbox3.Text = rng.offset(0,1).Value ' Current Pay, column C
End if
End Sub

--
Regards,
Tom Ogilvy

"bballmama43" wrote in message
oups.com...
I have been working no this problem for days. Let me start wtih saying
that I have already read Help, and have bought 2 books that I am
working with. This problem specifically is something I have a brain
block about. Any help is sincerely appreciated!

A very simple version of my spreadsheet is this:

A B C D E
Employee EmpNum CurrentPay Raise Yearly amount

I have created a UserForm with textboxes allow a user to enter cells A,
B, and C. It will create a new row at the end of my spreadsheet. E is
calculated from D and C.

What I want to do, and what I cannot do, is enter EmpNum (employee's
unique ID number) and have the fields updated on my UserForm. In other
words, I enter numbre 12345 and see that John Doe makes $30,000.00.
Then, I would like to enter John's raise into D.

I absolutely cannot figure out how to enter the number and show me the
remaining info from the row.

Any help out there for me? I have searched high and low for info on the
Find method and see that it is not as easy as I want it to be.

tia.
bballmama





All times are GMT +1. The time now is 08:23 AM.

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