Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Workbooks and Paste into same spreadsheet


I have several Workbooks I need to copy from and paste into one
spreadsheet.

Say Template1, Template2, Template3

All with the same columns and all starting on the same row and just
pasted in the new spreadsheet on the next blank row. How can I do this
adding onto the macro below? Thanks.


Workbooks.Open Filename:= _
"C:\Documents and Settings\My Documents\template1.xls"
Range("A5:R61").Select
Selection.Copy
Windows("MyFile.xls").Activate
Range("A5").Select
ActiveSheet.Paste
End Sub


--
lcannon
------------------------------------------------------------------------
lcannon's Profile: http://www.excelforum.com/member.php...o&userid=24253
View this thread: http://www.excelforum.com/showthread...hreadid=378627

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Copy Workbooks and Paste into same spreadsheet

Let's say that you open a workbook and transfer
Open the next workbook and transfer
and so on....
With this code in the master workbook...

than for each transfer - open a workbook

dim rw1 as Long, rw2 as Long

' find first open row in each workbook
rw1 = Thisworkbook.Sheets("MySheet").Cells(Rows.COUNT,
"A").End(xlUp).Offset(1, 0).Row
rw2 = Activeworkbook.ActiveSheet.Cells(Rows.COUNT, "A").End(xlUp).Offset(1,
0).Row

' transfer opened worksheet to master worksheet
Activeworkbook.ActiveSheet.Range(Cells(5,18),Cells (rw2,18).Copy _
Destination:= Thisworkbook.Sheets("MySheet").Cells(rw1,1)


You could set some conditions on rw1 like this:
If rw1<5 then
rw1 = 5
End If
--
steveB

Remove "AYN" from email to respond
"lcannon" wrote in
message ...

I have several Workbooks I need to copy from and paste into one
spreadsheet.

Say Template1, Template2, Template3

All with the same columns and all starting on the same row and just
pasted in the new spreadsheet on the next blank row. How can I do this
adding onto the macro below? Thanks.


Workbooks.Open Filename:= _
"C:\Documents and Settings\My Documents\template1.xls"
Range("A5:R61").Select
Selection.Copy
Windows("MyFile.xls").Activate
Range("A5").Select
ActiveSheet.Paste
End Sub


--
lcannon
------------------------------------------------------------------------
lcannon's Profile:
http://www.excelforum.com/member.php...o&userid=24253
View this thread: http://www.excelforum.com/showthread...hreadid=378627



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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy and paste between workbooks keith Excel Discussion (Misc queries) 2 February 18th 09 04:46 PM
Can NOT copy / paste across workbooks CL Chuck Excel Discussion (Misc queries) 3 September 29th 07 06:01 PM
Can't Copy and Paste between Workbooks Tom at Galanti & Company PC Excel Discussion (Misc queries) 4 May 7th 07 01:05 PM
Copy and Paste Between Workbooks Lee Excel Programming 2 November 13th 03 08:08 PM


All times are GMT +1. The time now is 07:45 AM.

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"