Hi Team,
I have used the code in question 965869 and can get a sequential number to populate via my user form to the required location on the spreadsheet, however this is writing to the spreadsheet before the other entered data is submitted to the sheet via the command button. This is forcing my remaining data to populate 1 line below the sequential number. Code is:
Private Sub CommandButton1_Click()
With ThisWorkbook.Worksheets("Sheet1")
.Cells(.Rows.Count, "A").End(xlUp).Offset(1) = TextBox1.Value
TextBox1.Text = Application.Max(.Range("A:A")) + 1
End With
End Sub
Private Sub UserForm_Initialize()
With ThisWorkbook.Worksheets("Sheet1")
TextBox1.Text = Application.Max(.Range("A:A")) + 1
End With
End Sub
If we can maybe change the sequence of events such that the generated number does not write to the sheet until the command button is pressed I think this might fix it
Any help please
I have used the code in question 965869 and can get a sequential number to populate via my user form to the required location on the spreadsheet, however this is writing to the spreadsheet before the other entered data is submitted to the sheet via the command button. This is forcing my remaining data to populate 1 line below the sequential number. Code is:
Private Sub CommandButton1_Click()
With ThisWorkbook.Worksheets("Sheet1")
.Cells(.Rows.Count, "A").End(xlUp).Offset(1) = TextBox1.Value
TextBox1.Text = Application.Max(.Range("A:A")) + 1
End With
End Sub
Private Sub UserForm_Initialize()
With ThisWorkbook.Worksheets("Sheet1")
TextBox1.Text = Application.Max(.Range("A:A")) + 1
End With
End Sub
If we can maybe change the sequence of events such that the generated number does not write to the sheet until the command button is pressed I think this might fix it
Any help please