paste issue

P

project manager

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.
 
J

joel

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top