octavo4219
12-10-2019, 02:48 AM
Hi all,
New to VBA and Userforms and having trouble figuring out my first real one here.
I get a "Compile Error: Invalid Qualifier" error whenever I click the OKButton - Always highlighting "Private Sub OKButton_Click()" after doing so.
I am comparing it to a very similar code and simply cant figure out where I am going wrong, any help would be amazing!
Private Sub OKButton_Click()
Dim emptyRow As Long
Sheet1.Activate
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(emptyRow, 2).Value = Name.Value
Cells(emptyRow, 3).Value = XS.Value
Cells(emptyRow, 5).Value = Description.Value
Cells(emptyRow, 10).Value = Fault.Value
Cells(emptyRow, 11).Value = ITC.Value
Cells(emptyRow, 12).Value = Trigger.Value
Cells(emptyRow, 13).Value = Why.Value
Cells(emptyRow, 20).Value = Await.Value
If Waive.Value = True Then Cells(emptyRow, 4).Value = "Waived"
If CheckBox2.Value = True Then Cells(emptyRow, 5).Value = "Claim Number"
If CheckBox3.Value = True Then Cells(emptyRow, 6).Value = "Assessment Process"
If CheckBox4.Value = True Then Cells(emptyRow, 7).Value = "Discussed Hire Car benefit"
If CheckBox5.Value = True Then Cells(emptyRow, 21).Value = "Discussed No Hire Car benefit"
If CheckBox6.Value = True Then Cells(emptyRow, 8).Value = "ePam Spun"
If CheckBox7.Value = True Then Cells(emptyRow, 9).Value = "SMS Sent"
If OK2P.Value = True Then Cells(emptyRow, 14).Value = "OK2P"
If CheckBox9.Value = True Then Cells(emptyRow, 15).Value = "OC Assessment"
If CheckBox10.Value = True Then Cells(emptyRow, 16).Value = "TP approach"
If CheckBox11.Value = True Then Cells(emptyRow, 17).Value = "TP Recovery"
If CheckBox12.Value = True Then Cells(emptyRow, 18).Value = "Hire Car Invoice"
If CheckBox13.Value = True Then Cells(emptyRow, 19).Value = "Tow Invoice"
If OKOption.Value = True Then
Cells(emptyRow, 1).Value = "OK"
Else
Cells(emptyRow, 1).Value = "WOP"
End If
End Sub
New to VBA and Userforms and having trouble figuring out my first real one here.
I get a "Compile Error: Invalid Qualifier" error whenever I click the OKButton - Always highlighting "Private Sub OKButton_Click()" after doing so.
I am comparing it to a very similar code and simply cant figure out where I am going wrong, any help would be amazing!
Private Sub OKButton_Click()
Dim emptyRow As Long
Sheet1.Activate
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(emptyRow, 2).Value = Name.Value
Cells(emptyRow, 3).Value = XS.Value
Cells(emptyRow, 5).Value = Description.Value
Cells(emptyRow, 10).Value = Fault.Value
Cells(emptyRow, 11).Value = ITC.Value
Cells(emptyRow, 12).Value = Trigger.Value
Cells(emptyRow, 13).Value = Why.Value
Cells(emptyRow, 20).Value = Await.Value
If Waive.Value = True Then Cells(emptyRow, 4).Value = "Waived"
If CheckBox2.Value = True Then Cells(emptyRow, 5).Value = "Claim Number"
If CheckBox3.Value = True Then Cells(emptyRow, 6).Value = "Assessment Process"
If CheckBox4.Value = True Then Cells(emptyRow, 7).Value = "Discussed Hire Car benefit"
If CheckBox5.Value = True Then Cells(emptyRow, 21).Value = "Discussed No Hire Car benefit"
If CheckBox6.Value = True Then Cells(emptyRow, 8).Value = "ePam Spun"
If CheckBox7.Value = True Then Cells(emptyRow, 9).Value = "SMS Sent"
If OK2P.Value = True Then Cells(emptyRow, 14).Value = "OK2P"
If CheckBox9.Value = True Then Cells(emptyRow, 15).Value = "OC Assessment"
If CheckBox10.Value = True Then Cells(emptyRow, 16).Value = "TP approach"
If CheckBox11.Value = True Then Cells(emptyRow, 17).Value = "TP Recovery"
If CheckBox12.Value = True Then Cells(emptyRow, 18).Value = "Hire Car Invoice"
If CheckBox13.Value = True Then Cells(emptyRow, 19).Value = "Tow Invoice"
If OKOption.Value = True Then
Cells(emptyRow, 1).Value = "OK"
Else
Cells(emptyRow, 1).Value = "WOP"
End If
End Sub