Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste Append from Excel to Access ibeetb Excel Programming 1 February 27th 06 04:29 PM
How do I paste to append instead of replace existing data? Joel Thomas Excel Discussion (Misc queries) 1 October 3rd 05 01:32 PM
how to know which row to append for the last row tango Excel Programming 2 October 16th 04 02:23 PM
Qn: How to Append??? Michael Vaughan Excel Programming 1 September 19th 04 05:32 PM
append row Joe Excel Programming 4 July 30th 04 04:47 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"