Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste Append from Excel to Access | Excel Programming | |||
How do I paste to append instead of replace existing data? | Excel Discussion (Misc queries) | |||
how to know which row to append for the last row | Excel Programming | |||
Qn: How to Append??? | Excel Programming | |||
append row | Excel Programming |