Paste Append?

K

Kris

I am trying to copy data from one worksheet to the end of the data on
another worksheet. I found this macro but it only works with one row.
Perhaps someone can help me modify it.

Thanks


QUOTE
Hi Dr Bob,


There is no direct equivalent of AppendBelow. The following code should

do the job where you have named the target area Database and the single

line of new data as HoldArea:


Sub Test()
AppendBelow "Database", "HoldArea"
End Sub


Sub AppendBelow(Target, Source)
With Range(Target)
Range(Source).Copy Destination:=.Offset(.Rows.Count).Resize(1,1)
.Resize(.Rows.Count + 1).Name = Target
End With
End Sub


The code copies HoldArea below Database and extends the range of
Database
by one row,


HTH,
 
N

Norman Jones

Hi Kris,

Try something like:

'=============>>
Public Sub Tester()
Dim WB As Workbook
Dim srcSH As Worksheet
Dim destSH As Worksheet
Dim srcRng As Range
Dim destrng As Range

Set WB = Workbooks("Book2.xls") '<<==== CHANGE
Set srcSH = WB.Sheets("Sheet1") '<<==== CHANGE
Set destSH = WB.Sheets("Sheet2") '<<==== CHANGE
Set srcRng = srcSH.Range("A1:D10") '<<==== CHANGE

Set destrng = destSH.Cells(Rows.Count, "A").End(xlUp)(2)

srcRng.Copy Destination:=destrng

End Sub
'<<=============
 

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