0

I want my data to start with row number 5 but instead, the data go straight to the bottom.

Private Sub CommandButton6_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("BEAM SUM CONC")

iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

With ws
.Cells(iRow, "B") = TextBox1.Value
.Cells(iRow, "C") = TextBox2.Value
.Cells(iRow, "D") = TextBox3.Value
.Cells(iRow, "E") = TextBox4.Value
.Cells(iRow, "F") = TextBox5.Value
.Cells(iRow, "G") = TextBox6.Value
.Cells(iRow, "H") = TextBox7.Value

End With
End Sub

howw?

kekehere
  • 1
  • 1
  • Does your sheet contain a table (`ListObject`)? It would seem so from your previous question. Finding the last row in a table requires looking in the *table*, not at `ws.Cells`. – BigBen Jun 10 '21 at 15:08
  • no table just a column and row with border. im not set specific table for the sheet @BigBen – kekehere Jun 10 '21 at 15:13
  • Specify `After:=ws.Range("A1")` in the `Find`? Or use `End(xlUp)` as you did previously. The linked thread shows how to properly find the last row. If you don't have a table, then I find `End(xlUp)` to be the easiest. – BigBen Jun 10 '21 at 15:14
  • `End(Xlup)` doesn't work on another sheet. just one sheet only – kekehere Jun 10 '21 at 15:16
  • Sure it works on another sheet. – BigBen Jun 10 '21 at 15:27

0 Answers0