Paste Append?
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, |
Paste Append?
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 '<<============= --- Regards, Norman "Kris" wrote in message ups.com... 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, |
All times are GMT +1. The time now is 04:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com