Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi please can you help me with the code below, it doesnt seem to put data on a new line and go down 1 column. instead it overwrites the previous data once the command button is clicked on. Hope you can help me please?
VBA Code:
Private Sub CommandButton4_Click()
Dim emptyRow As Long
With ThisWorkbook.Sheets("Additional Job")
emptyRow = Cells(Rows.Count, "A").End(xlUp).Row + 1
.Cells(emptyRow, 3).Value = TextBox1.Value
.Cells(emptyRow, 2).Value = TextBox10.Value
.Cells(emptyRow, 1).Value = ComboBox2.Value
.Cells(emptyRow, 5).Value = TextBox2.Value
.Cells(emptyRow, 6).Value = TextBox11.Value
.Cells(emptyRow, 7).Value = TextBox3.Value
.Cells(emptyRow, 13).Value = ComboBox4.Value
.Cells(emptyRow, 12).Value = ComboBox3.Value
.Cells(emptyRow, 14).Value = TextBox4.Value
.Cells(emptyRow, 15).Value = TextBox12.Value
.Cells(emptyRow, 17).Value = TextBox5.Value
.Cells(emptyRow, 18).Value = TextBox6.Value
.Cells(emptyRow, 19).Value = TextBox7.Value
.Cells(emptyRow, 20).Value = TextBox8.Value
.Cells(emptyRow, 21).Value = TextBox9.Value
End With
Unload Me
End Sub