Code:
Private Sub CommandButton2_Click()
LastRow = Range("A65536").End(xlUp).Row
LastRow = LastRow + 1
Sheet1.Range("A" & LastRow) = Calendar1.Value
Sheet1.Range("A" & LastRow).NumberFormat = "dd-mmm-yyyy"
Sheet1.Range("b" & LastRow).Value = TextBox1.Value
Sheet1.Range("c" & LastRow).Value = TextBox2.Value
Sheet1.Range("d" & LastRow).Value = TextBox3.Value
Sheet1.Range("e" & LastRow).Value = TextBox5.Value
Sheet1.Range("f" & LastRow).Value = TextBox6.Value
Sheet1.Range("g" & LastRow).Value = TextBox7.Value
Sheet1.Range("h" & LastRow).Value = TextBox4.Value
Call SortAscending
Unload Me
End Sub
I'm butchering VBA, but I have to start somewhere.
I've got a userform with a command button on sheet4 that inserts input values into cells on a sheet1 once the "OK" button is clicked. I then sort the data via the date in column A via the Macro "SortAscending" that is just a recorded macro using the sort ascending button on the toolbar.
The data selects the last row that data was entered into and overwrites the data in the row rather than finding the next open row to place the data in.
Thanks.