ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add a row to the bottom of a worksheet. (https://www.excelbanter.com/excel-discussion-misc-queries/63698-add-row-bottom-worksheet.html)

Box666

Add a row to the bottom of a worksheet.
 
I have a macro that summaries data on sheet1, I then want it to append
this data in the form of a new row to the bottom of sheet2.

Is there a formula that I can use to locate the next blank row, or what
is the best way to achieve this please.


Dave Peterson

Add a row to the bottom of a worksheet.
 
Maybe you could just copy and paste that row in your macro.

Option Explicit
sub testme()
dim DestCell as range
dim RngToCopy as range
'your code to get the summaries

'whatever row holds the
set rngtocopy = worksheets("sheet1").range("a999").entirerow

with worksheets("sheet2")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

rngtocopy.copy _
destination:=destcell

'or
rngtocopy.copy
destcell.pastespecial paste:=xlpastevalues

end sub

I used column A of sheet2 to find the next available row.



Box666 wrote:

I have a macro that summaries data on sheet1, I then want it to append
this data in the form of a new row to the bottom of sheet2.

Is there a formula that I can use to locate the next blank row, or what
is the best way to achieve this please.


--

Dave Peterson


All times are GMT +1. The time now is 04:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com