ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and paste contents of one sheet into another (https://www.excelbanter.com/excel-programming/395914-copy-paste-contents-one-sheet-into-another.html)

Darin Kramer

Copy and paste contents of one sheet into another
 


Hi,

Ive got two books open, say book a and book b.

I need to systematically go through all the sheets in Book A and for
each sheet select all cells, copy, and then goto the sheet in Book B
(with the same name, but which is blank) and paste all the cells.

Your expert held would be most appreciated by me (not so expert!)

Regards

D

*** Sent via Developersdex http://www.developersdex.com ***

Vergel Adriano

Copy and paste contents of one sheet into another
 
Darin,

try something like this:

Sub test()
Dim sh As Worksheet

For Each sh In Workbooks("A.xls").Worksheets
sh.Cells.Copy
Destination:=Workbooks("B.xls").Worksheets(sh.Name ).Cells(1, 1)
Next sh

End Sub


--
Hope that helps.

Vergel Adriano


"Darin Kramer" wrote:



Hi,

Ive got two books open, say book a and book b.

I need to systematically go through all the sheets in Book A and for
each sheet select all cells, copy, and then goto the sheet in Book B
(with the same name, but which is blank) and paste all the cells.

Your expert held would be most appreciated by me (not so expert!)

Regards

D

*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 02:54 AM.

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