0

i tried to place the data at column 5 row B but the data place at bottom of the excel table

Private Sub CommandButton20_Click() 

Dim sh As Worksheet
Dim le As Long
Dim lastrow As Double
Set sh = ThisWorkbook.Sheets("SUM-REBAR (C)")
lastrow = ActiveSheet.Cells(Rows.Count, 5).End(xlUp).Row 
With sh
.Cells(lastrow + 1, "B") = TextBox33.Value 
.Cells(lastrow + 1, "C") = TextBox35.Value
.Cells(lastrow + 1, "D") = TextBox34.Value
.Cells(lastrow + 1, "E") = TextBox36.Value
End With
End Sub
kekehere
  • 1
  • 1
  • `End(xlUp)` doesn't work to find the last row in a table. See the linked thread for an approach for tables. – BigBen Jun 09 '21 at 17:04

0 Answers0