ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   paste issue (https://www.excelbanter.com/excel-programming/427529-paste-issue.html)

project manager

paste issue
 
i would like to copy one list in a worksheet A to worksheet B but sheet B has
title rows of data starting in row 2 which cant be overwritten. If column A
has data in itit needs to paste below it. worksheet A is a list with no
breaks. so if sheet B has data, 7row breaks, data, 3 row break... it needs
to sopy the first 7 (of sheet A) of the list starting to paste at row 2 in
sheet B, then recognise the gap required and paste the next 3 below it (row
10).

any help?

cheers.

joel

paste issue
 
set ShtA = sheets("Sheet1")
set ShtB = sheets("Sheet2")

'start at A1 and look down until last data cell is found
LastRow = ShtA.Range("A1").end(xldown).Row
Set CopyRows = Rows("1:" & LastRow)

'go to last row of worksheet and move up until data is found
LastRow = ShtB.Range("A" & Rows.Count).end(xlup).Row
NewRow = LastRow + 3

CopyRows.Copy _
Destination:=ShtB.Rows(NewRow)



"project manager" wrote:

i would like to copy one list in a worksheet A to worksheet B but sheet B has
title rows of data starting in row 2 which cant be overwritten. If column A
has data in itit needs to paste below it. worksheet A is a list with no
breaks. so if sheet B has data, 7row breaks, data, 3 row break... it needs
to sopy the first 7 (of sheet A) of the list starting to paste at row 2 in
sheet B, then recognise the gap required and paste the next 3 below it (row
10).

any help?

cheers.



All times are GMT +1. The time now is 08:11 PM.

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