Hi guys & gals, I'm new here and also fairly new to VBA. I have a userform I want to use to fill in a table on a worksheet. I have the clear and Cancel buttons working fine but the submit form button is not working. Bellow is the code I have, your help is appriciated!
Private Sub SubmitForm_Click()
Dim emptyRow As Long
'Make Sheet Log Current Active
Worksheet(Log - Current).Activate
'Determine Empty Row
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Transfer Information
'Text Boxes
Cells(emptyRow, 22).Value = TextBox2
Cells(emptyRow, 23).Value = TextBox3
Cells(emptyRow, 26).Value = TextBox4
Cells(emptyRow, 27).Value = TextBox5
Cells(emptyRow, 29).Value = TextBox6
Cells(emptyRow, 18).Value = DivisionListBox
Cells(emptyRow, 19).Value = BusinessUnitListBox
'Specialist Boxes
If SpecialistCheckBox1.Value = True Then Cells(emptyRow, 2).Value = SpecialistCheckBox1.Caption
If SpecialistCheckBox2.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & SpecialistCheckBox2.Caption
If SpecialistCheckBox3.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & SpecialistCheckBox3.Caption
If SpecialistCheckBox4.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & SpecialistCheckBox4.Caption
'Type of Change
If HireBox.Value = True Then Cells(emptyRow, 2).Value = HireBox.Caption
If RehireBox.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & RehireBox.Caption
If TransferBox.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & TransferBox.Caption
If PersonalChangeBox.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & PersonalChangeBox.Caption
'Plan Type
If PlanBox1.Value = True Then Cells(emptyRow, 2).Value = PlanBox1.Caption
If PlanBox2.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & PlanBox2.Caption
If PlanBox3.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & PlanBox3.Caption
'Hourly/Salaried
If HourlyBox.Value = True Then Cells(emptyRow, 2).Value = HourlyBox.Caption
If SalaryBox.Value = True Then Cells(emptyRow, 2).Value = Cells(emptyRow, 2).Value & " " & SalaryBox.Caption
Else
Cells(emptyRow, 3).Value = LogNumberBox1
End If
Cells(emptyRow, 24).Value = CommentsBox
End Sub
Thanks!
Bookmarks