populate adjacent row details in Userform
Hi, Please help I am Creating a simple userform to populate adjacent rows data in userform. A user enters Employee Id in Txt_Box EmployeeId & after clicking "OK", He Gets Populated Userform from the adjacent rows, From which he can know if the employee is valid or not. I have attached my file for reference also pasting my code below... (Please Help Me with it)
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 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
Attachment | Size |
---|---|
New Microsoft Office Excel Worksheet (2).xlsm | 34.86 KB |
- omkar sathaye's blog
- Login or register to post comments
- 2787 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago