Groovicles
Board Regular
- Joined
- Nov 27, 2013
- Messages
- 52
Hi everyone,
I have the following code:
What I'm trying to get the userform "UnitEntryform" to do is populate TextBox1 and TextBox2 with the results in columns A and B of the template for each active row selected from column G. Right now, the first entry the user makes is pre-populated with the corresponding results found in columns A and B in the appropriate TextBoxes. However, when the user press Save Employee so that they move to the next active row, the TextBox1 and 2 does not show the results in A and B in the appropriate active row.
Anyway I can have the results in columns A and B populated in TextBox 1 and 2 for the appropriate row? I would attach a sample template but I can't seem to see where to do it.
Thanks everyone!!
I have the following code:
Code:
Private Sub CommandButton1_Click()
Dim RowCount As Long
Dim ctl As Control
With Me
.TextBox1.Value = Cells(ActiveCell.Row, "A").Value
.TextBox2.Value = Cells(ActiveCell.Row, "B").Value
End With
If Me.ComboBox1.Value = "" Then
MsgBox "Please Select Employee Status.", vbExclamation, "Entry Form"
Me.ComboBox1.SetFocus
End If
If Me.ComboBox2.Value = "" Then
MsgBox "Please Select Licensed Rep Status.", vbExclamation, "Entry Form"
Me.ComboBox2.SetFocus
End If
If Me.ComboBox3.Value = "" Then
MsgBox "Please Select Language Preference.", vbExclamation, "Entry Form"
Me.ComboBox3.SetFocus
End If
If Me.ComboBox4.Value = "" Then
MsgBox "Please Select Current Role Experience.", vbExclamation, "Entry Form"
Me.ComboBox4.SetFocus
End If
If Me.TextBox3.Value = "" Then
MsgBox "Please Enter Post #.", vbExclamation, "Entry Form"
Me.TextBox3.SetFocus
End If
If Me.TextBox4.Value = "" Then
MsgBox "Please Enter Portfolio #.", vbExclamation, "Entry Form"
Me.TextBox4.SetFocus
End If
RowCount = Worksheets("Info Request").Range("G" & Rows.Count).End(3)(2).Row
With Worksheets("Info Request")
.Cells(RowCount, 7).Value = Me.ComboBox4.Value
.Cells(RowCount, 8).Value = Me.ComboBox1.Value
.Cells(RowCount, 9).Value = Me.ComboBox2.Value
.Cells(RowCount, 10).Value = Me.TextBox3.Value
.Cells(RowCount, 11).Value = Me.TextBox4.Value
.Cells(RowCount, 12).Value = Me.TextBox5.Value
.Cells(RowCount, 13).Value = Me.ComboBox3.Value
End With
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 CommandButton2_Click()
Unload Me
End Sub
Private Sub Userform_Initialize()
With Me
.TextBox1.Value = Cells(ActiveCell.Row, "A").Value
.TextBox2.Value = Cells(ActiveCell.Row, "B").Value
End With
With ComboBox1
.AddItem "Full Time"
.AddItem "Part Time"
End With
With ComboBox2
.AddItem "MFDA"
.AddItem "MFDA < 90 Days"
.AddItem "IIROC"
End With
With ComboBox3
.AddItem "English"
.AddItem "French"
End With
With ComboBox4
.AddItem "<3 Months"
.AddItem "3 Months - 1 Year"
.AddItem "1 Year - 4 Years"
.AddItem "Over 4 Years"
End With
End Sub
What I'm trying to get the userform "UnitEntryform" to do is populate TextBox1 and TextBox2 with the results in columns A and B of the template for each active row selected from column G. Right now, the first entry the user makes is pre-populated with the corresponding results found in columns A and B in the appropriate TextBoxes. However, when the user press Save Employee so that they move to the next active row, the TextBox1 and 2 does not show the results in A and B in the appropriate active row.
Anyway I can have the results in columns A and B populated in TextBox 1 and 2 for the appropriate row? I would attach a sample template but I can't seem to see where to do it.
Thanks everyone!!