#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"