**Problem:**I need insert the data after last used row in the worksheet. I was able to find last used row with the following code.
ActiveSheet.Cells.(Rows.count, "D").End(xlUp).row
Now here I have to insert data next to the last used row.
**Problem:**I need insert the data after last used row in the worksheet. I was able to find last used row with the following code.
ActiveSheet.Cells.(Rows.count, "D").End(xlUp).row
Now here I have to insert data next to the last used row.
Define lastrow
as a variable first.
What .row
does is returns a number indicating the row, in this case the last row. The +1
moves it down by 1 cell.
Dim lastrow as Long
lastrow = Activesheet.Cells(Rows.Count, "D").End(xlUp).row + 1
Activesheet.Cells(lastrow, "D").Value = "Your Value here"