I followed a guide online which said to said to setup a multi-page within user-form and then the code was supplied but still getting syntax errors and can't seem to work out what wrong.
I want end user to choose which page they want to fill out and then they hit submit and it'll then submit the data into the correct sheet within the workbook.
If user has piece of new kit to register in system they fill out register bit and then hit submit and it puts data into the register sheet, so on and so forth e.g. fill out deploy kit form it put data into the deploy sheet.
the asset number at top of form gets automatically added to each entry.
ignore reporting page going to tackle that at a later date.
I try add code after posting question error popping up
Private Sub SB1_Click()
Dim lrREG As Long, lrB As Long, lrDep As Long, lrDis As Long
lrREG = Sheets("Register").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Register").Cells(lrREG + 1, "A").Value = TextBox1.Text
Sheets("Register").Cells(lrREG + 1, "B").Value = TextBox2.Text
Sheets("Register").Cells(lrREG + 1, "C").Value = TextBox3.Text
Sheets("Register").Cells(lrREG + 1, "D").Value = TextBox4.Text
Sheets("Register").Cells(lrREG + 1, "E").Value = TextBox5.Text
Sheets("Register").Cells(lrREG + 1, "F").Value = TextBox6.Text
End Sub
I will do it this way, using Range and Declaring Workbook and you always mention the name of the UserForm when you are calling its objects.
Private Sub SB1_Click()
'Declare the Variables
Dim lrREG As Long
Dim WrReg as Long
Dim Wk As Workbook
'Assign the Declared Variables
Set Wk = ActiveWorkbook
lrREG = Wk.Sheets("Register").Range("A" & Rows.Count).End(xlUp).Row
WrReg = lrREG + 1
Sheets("Register").Range("A" & wrReg).Value = FormName.TextBox1.Value
Sheets("Register").Range("B" & wrReg).Value = FormName.TextBox2.Value
Sheets("Register").Range("C" & wrReg).Value = FormName.TextBox3.Value
Sheets("Register").Range("D" & wrReg).Value = FormName.TextBox4.Value
Sheets("Register").Range("E" & wrReg).Value = FormName.TextBox5.Value
Sheets("Register").Range("F" & wrReg).Value = FormName.TextBox6.Value
End Sub