Compile Error: Method or data member not found error

Joined
Apr 7, 2015
Messages
1
Reaction score
0
I'm trying to make a userform and I'm not sure what went wrong with the command button code, could someone just look at it and tell me what to change, Thank you :)

Private Sub commandbutton_add_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.textbox_title.Value
ws.Cells(iRow, 2).Value = Me.textbox_name.Value
ws.Cells(iRow, 3).Value = Me.textbox_surname.Value
ws.Cells(iRow, 4).Value = Me.textbox_address.Value
ws.Cells(iRow, 5).Value = Me.textbox_party.Value
ws.Cells(iRow, 6).Value = Me.TextBox_number.Value
ws.Cells(iRow, 7).Value = Me.textbox_date.Value

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
Me.textbox_title.Value = ""
Me.textbox_name.Value = ""
Me.textbox_surname.Value = ""
Me.textbox_address.Value = ""
Me.textbox_party.Value = ""
Me.TextBox_number.Value = ""
Me.textbox_date.Value = ""
Me.textbox_title.SetFocus

End Sub
 
Back
Top