Hi everybody!
I'm a self learner in case of VBA.
Actually I'm starting with it.
Could you please help me with this code?
I don't know why I'm getting a error message if I choose a second (checkbox2)??
If I choose the first checkbox1 it woprks.
Private Sub Checkbox1_Click()
Dim emptyRow As String
If usfdoc.CheckBox1.Value = True Then
Sheet2.Activate
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(emptyRow, 1).Value = "Company1"
End If
If usfdoc.CheckBox1.Value = True Then
Sheet2.Activate
emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
Cells(emptyRow, 2).Value = "OPE contract"
End If
If usfdoc.CheckBox1.Value = True Then
Sheet2.Activate
emptyRow = WorksheetFunction.CountA(Range("D:D")) + 1
Cells(emptyRow, 4).Value = "Hire"
End If
usfOPE.Show
End Sub
Private Sub CheckBox2_Click()
' Enters the company name, document name, WC data in to a specific cell
Dim emptyRow As String
If usfdoc.CheckBox2.Value = True Then
Sheet2.Activate
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(emptyRow, 1).Value = "Company1"
End If
If usfdoc.CheckBox2.Value = True Then
Sheet2.Activate
emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
Cells(emptyRow, 2).Value = "FTC contract"
End If
If usfdoc.CheckBox2.Value = True Then
Sheet2.Activate
emptyRow = WorksheetFunction.CountA(Range("D:D")) + 1
Cells(emptyRow, 4).Value = "Hire"
End If
usfFTC.Show
End Sub
Thank you for your help,
Laik2013
Bookmarks