ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy and Paste (https://www.excelbanter.com/excel-discussion-misc-queries/159138-copy-paste.html)

David T

Copy and Paste
 
Hello All-

I need to macro that will copy all the data starting on row 17 and paste it
in the first available row in another File.

For example, I need rows 7-22 of File c:\2008 Tport to be copied into File
C:\Master. Then i should be able use the same macro to copy rows 7-55 of
file C:\2007 Tport to copy into the first availble row in c:\Master. Can
anyone help?

chad

Copy and Paste
 
To copy rows 7-22 from 2008.xls to Master.xls use
Rows("7:22").Select
Selection.Copy
Workbooks("Master.xls").Activate
ActiveSheet.Paste
Application.CutCopyMode = False

To copy rows 7-55 from 2007.xls to first available row in Master.xls, use
Rows("7:55").Select
Application.CutCopyMode = False
Selection.Copy
Workbooks("Master.xls").Activate
Range("A1").Select
Selection.End(xlDown).Select
gotorow = ActiveCell.Row + 1
gotorange = "A" & gotorow
Range(gotorange).Select
ActiveSheet.Paste

Hope this helps,
-Chad


"David T" wrote:

Hello All-

I need to macro that will copy all the data starting on row 17 and paste it
in the first available row in another File.

For example, I need rows 7-22 of File c:\2008 Tport to be copied into File
C:\Master. Then i should be able use the same macro to copy rows 7-55 of
file C:\2007 Tport to copy into the first availble row in c:\Master. Can
anyone help?



All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com