ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help (https://www.excelbanter.com/excel-programming/401299-help.html)

Mfadli

Help
 
Hi,

I have one problem in create a data in userform.

The problem is:


1) I want to type the staff ID and the name will appear. I try to use
function "If" but its limited to 64 k only for every function. I also
use vlookup and link to the sheet. But still have a error. Please
guide me. Thank You

Example:

Staff Id : 010035
Name : Automitacally appear when i type a staff Id
(this scenario in user form, not in sheet)

Can anybody provide the code

Per Jessen

Help
 

I have one problem in create a data in userform.

The problem is:


1) I want to type the staff ID and the name will appear. I try to use
function "If" but its limited to 64 k only for every function. I also
use vlookup and link to the sheet. But still have a error. Please
guide me. Thank You

Example:

Staff Id : 010035
Name : Automitacally appear when i type a staff Id
(this scenario in user form, not in sheet)

Can anybody provide the code


Hi

Assuming that you have a sheet named "Staff" where you have staff ID and
name in column A and B.
The trick is to use the "VAL()" function.

Try this code:

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
ID = Val(Me.TextBox1.Value)
tsheet = ActiveSheet.Name
rSheet = "Staff"
Sheets(rSheet).Select
startcell = "A2"
Lastcell = Range(startcell).End(xlDown).Address
Range(startcell).Select
For Each c In Range(startcell, Lastcell)
If ID = c Then
Me.TextBox2.Value = ActiveCell.Offset(0, 1).Value
End
End If
ActiveCell.Offset(1, 0).Select
Next
Sheets(tsheet).Activate
End Sub

Sincerly,

Per




All times are GMT +1. The time now is 03:44 AM.

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