简体   繁体   中英

Excel 2007 Copy range values and paste to another range (Same Sheet) first empty row

Total Newbie here. Need help making this simple code work. Every time I run the macro I need it to find the next open row in the target row and paste. Obviously the first time I run, it work but the next time it pastes it on top of the previous paste. The number of rows I need it to paste will vary, so it needs to check the space then paste what it's copying each time I run the code.

Sub Save()
Range("A19:I100").Copy Destination:=Range("N5:V1000")
End Sub

Thanks in advance

Try to use next code:

Sub Save()
    Dim lastrow As Long
    lastrow = Cells(Rows.Count, "N").End(xlUp).Row
    Range("A19:I100").Copy Destination:=Range("N" & lastrow + 1)
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM