omkar sathaye
New Member
- Joined
- Jan 22, 2014
- Messages
- 2
Hi, I m new to this forum & Also for VBA I m creating a userform which will search an employee id entered in one textbox of userform, as user will hit OK it traces the entered number and displays it and its adjacent rows details in userform, which will be uneditable in userform, my userform traces the userinput but i don,t have idea to auto populate remaining fields of userform... also please help to create hotkey to relaunch my userform...
my sheet contains..:
Column A : Employee ID
Column B : Employee Status (No need to populate in userform)
Column C : Employee Name
Column D : Termination Date
Column E : Location
Column F : Exit Type( Reason of Termination)
Below is my userform please assist Guys...
Dim ctl As Control
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdclear_Click()
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
End Sub
Private Sub CmdOK_Click()
Dim ws As Worksheet
Dim FindString As String
Dim Rng As Range
Set ws = ThisWorkbook.Worksheets("Sheet1")
FindString = TxtEmployeeID.Value
If Trim(FindString) <> "" Then
Set Rng = ws.Cells.Find( _
What:=FindString, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "No Match Found !"
End If
End If
End Sub
Private Sub Label5_Click()
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub TxtDateofTermination_Change()
End Sub
Private Sub TxtEmployeeID_Change()
End Sub
Private Sub TxtEmployeename_Change()
End Sub
Private Sub TxtLocation_Change()
End Sub
Private Sub TxtReasonofTermination_Change()
End Sub
my sheet contains..:
Column A : Employee ID
Column B : Employee Status (No need to populate in userform)
Column C : Employee Name
Column D : Termination Date
Column E : Location
Column F : Exit Type( Reason of Termination)
Below is my userform please assist Guys...
Dim ctl As Control
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdclear_Click()
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
End Sub
Private Sub CmdOK_Click()
Dim ws As Worksheet
Dim FindString As String
Dim Rng As Range
Set ws = ThisWorkbook.Worksheets("Sheet1")
FindString = TxtEmployeeID.Value
If Trim(FindString) <> "" Then
Set Rng = ws.Cells.Find( _
What:=FindString, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "No Match Found !"
End If
End If
End Sub
Private Sub Label5_Click()
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub TxtDateofTermination_Change()
End Sub
Private Sub TxtEmployeeID_Change()
End Sub
Private Sub TxtEmployeename_Change()
End Sub
Private Sub TxtLocation_Change()
End Sub
Private Sub TxtReasonofTermination_Change()
End Sub
Last edited: