I have produced this code to sit on a button that belongs to a UserForm…
Private Sub CommandButton1_Click()
Dim lngWriteRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
NextRow = Cells(Rows.Count, 2).End(xlUp).Row + 1
lngWriteRow = ws.Cells(Rows.Count, 2).End(xlUp) _
.Offset(12, 0).NextRow
ws.Range("B" & lngWriteRow) = TextBox1.Value
ws.Range("C" & lngWriteRow) = TextBox2.Value
ws.Range("D" & lngWriteRow) = TextBox3.Value
ws.Range("E" & lngWriteRow) = ComboBox1.Value
ws.Range("F" & lngWriteRow) = TextBox4.Value
ws.Range("G" & lngWriteRow) = ComboBox2.Value
End Sub
It wont automatically move to the next row, and will overwrite the row number 14, when i want it to update 15 when 14 has data in it, then when 15 does, update 16 and so on…
Any ideas?
Since you’re only placing data in columns B onwards, you should look at those columns, not column A as your code is currently doing. This should fix it: