I have made a simple form to allow me to input data and store it on an excel table. Before adding simple formulas I was able to submit and the data and populate the next line of the excel table when I hit submit on my form.
I have now added simple formulas that will be used on the data I submit, however when I try to submit data, the formula and inputted data split over 2 separate line in my Excel table (as you can see in the attached image). Can you help me populate the data into the same line as the formulas.
Apologies for any bad code as I haven't tidied it yet, just getting the basics right.
Private Sub CommandButton1_Click()
lastrow = ThisWorkbook.Worksheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 1).Value = TextBox1.Text
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 3).Value = TextBox9.Text
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 8).Value = TextBox12.Text
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 10).Value = TextBox11.Text
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 11).Value = TextBox10.Text
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 16).Value = TextBox15.Text
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 18).Value = TextBox14.Text
ThisWorkbook.Worksheets("Sheet1").Cells(lastrow + 1, 19).Value = TextBox13.Text
Sheets("Sheet1").Range("A4").Select
ActiveCell.EntireRow.Insert shift:=xlDown
Sheets("Sheet1").Range("A4:V4").Select
Selection.Borders.Weight = xlThin
Sheets("Sheet1").Range("b4").Select
ActiveCell.Formula = "=(a4*1440)"
Sheets("Sheet1").Range("d4").Select
ActiveCell.Formula = "=(b4*(c4/100))"
Sheets("Sheet1").Range("e4").Select
ActiveCell.Formula = "=((d4/b4)*100)"
Sheets("Sheet1").Range("f4").Select
ActiveCell.Formula = "=(100-e4)"
Sheets("Sheet1").Range("i4").Select
ActiveCell.Formula = "=(h4*1440)"
Sheets("Sheet1").Range("l4").Select
ActiveCell.Formula = "=(i4*(((j4+k4)/2)/100))"
Sheets("Sheet1").Range("m4").Select
ActiveCell.Formula = "=((l4/i4)*100)"
Sheets("Sheet1").Range("n4").Select
ActiveCell.Formula = "=(100-m4)"
Sheets("Sheet1").Range("q4").Select
ActiveCell.Formula = "=(p4*1440)"
Sheets("Sheet1").Range("t4").Select
ActiveCell.Formula = "=(q4*(((r4+s4)/2)/100))"
Sheets("Sheet1").Range("u4").Select
ActiveCell.Formula = "=((t4/q4)*100)"
Sheets("Sheet1").Range("v4").Select
ActiveCell.Formula = "=(100-u4)"
End Sub