I made a UserForm with Excel. It has TextBoxes and CheckBoxes and command buttons. UserForm starts with TextBoxes and after that some CheckBoxes come up and TextBoxes goes on. cmdAddData_click
is for to send data to sheet. I searched a lot but I'm a newbie around here.
When I want to send data it gives
run-time error, Application-defined or object defined error.
Appreciate for all helps.
Private Sub cmdAddData_Click()
lastrow = ThisWorkbook.Worksheets("00. Active Customers").Cells(Rows.Count, 1).End(xlUp).Row
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 0).Value = txtDate.Text
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 1).Value = txtName.Text
'after 34 textboxes, now for checkboxes
If cbxADSL.Value = True Then
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 35).Value = "Yes"
Else
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 35).Value = "No"
End If
If cbxAlarm.Value = True Then
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 36).Value = "Yes"
Else
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 36).Value = "No"
End If
'after checkboxes, now for textboxes
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 122).Value = txtFirstContact.Text
ThisWorkbook.Worksheets("00. Active Customers").Cells(lastrow + 1, 123).Value = txtLastContact.Text
End Sub
Aucun commentaire:
Enregistrer un commentaire