Am desperately trying to get the below code working (I'm very new to VBA). I basically have a userform with textboxes and a cmd button. The userform opens in one worksheet and I want to paste the data to the last row of a customer list in a different worksheet. The bug starts at the line: emptyRow=Sheet8.Cells(Rows.Count,1).End(x1Up).Offset(1,0).Row
There will be times when only some of the textboxes will be completed. Really appreciate advice
Private Sub cmdAddCustomerData_Click()
Sheets("Cust Details").Select
emptyRow=Sheet8.Cells(Rows.Count,1).End(x1Up).Offset(1,0).Row
Cells(emptyRow,4)=TextboxCustName.Text
Cells(emptyRow,8)=TextboxStreet1.Text
Cells(emptyRow,9)=TextboxStreet2.Text
Cells(emptyRow,10)=TextboxTown.Text
Cells(emptyRow,11)=TextboxCounty.Text
Cells(emptyRow,12)=TextboxPostCode.Text
Cells(emptyRow,13)=TextboxContactName.Text
Cells(emptyRow,14)=TextboxTel.Text
Cells(emptyRow,15)=TextboxFax.Text
Cells(emptyRow,102)=TextboxInstructions.Text
Cells(emptyRow,109)=ComboBoxTradeTerms.Text
Cells(emptyRow,110)=ComboBoxPayMethod.Text
Cells(emptyRow,112)= ComboBoxPrintInv.Text
Cells(emptyRow,113)= ComboBoxPrintDelNote.Text
Cells(emptyRow,114)=TextboxEmail.Text
Sheets("Inputs").Select
End Sub
There will be times when only some of the textboxes will be completed. Really appreciate advice
Private Sub cmdAddCustomerData_Click()
Sheets("Cust Details").Select
emptyRow=Sheet8.Cells(Rows.Count,1).End(x1Up).Offset(1,0).Row
Cells(emptyRow,4)=TextboxCustName.Text
Cells(emptyRow,8)=TextboxStreet1.Text
Cells(emptyRow,9)=TextboxStreet2.Text
Cells(emptyRow,10)=TextboxTown.Text
Cells(emptyRow,11)=TextboxCounty.Text
Cells(emptyRow,12)=TextboxPostCode.Text
Cells(emptyRow,13)=TextboxContactName.Text
Cells(emptyRow,14)=TextboxTel.Text
Cells(emptyRow,15)=TextboxFax.Text
Cells(emptyRow,102)=TextboxInstructions.Text
Cells(emptyRow,109)=ComboBoxTradeTerms.Text
Cells(emptyRow,110)=ComboBoxPayMethod.Text
Cells(emptyRow,112)= ComboBoxPrintInv.Text
Cells(emptyRow,113)= ComboBoxPrintDelNote.Text
Cells(emptyRow,114)=TextboxEmail.Text
Sheets("Inputs").Select
End Sub