ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Worksheets Into Master Workbook (https://www.excelbanter.com/excel-programming/398392-copy-worksheets-into-master-workbook.html)

Fred

Copy Worksheets Into Master Workbook
 

I would like to create a macro that will all copy all of the worksheets in
the current workbook into the master workbook.

Please help me create this macro.

Thank you very much.

joel

Copy Worksheets Into Master Workbook
 
Sub copyall()

With Workbooks("Master.xls")
sheetcount = .Worksheets.Count

For Each wks In ThisWorkbook.Worksheets
.Worksheets.Add after:=Sheets(sheetcount)
wks.Cells.Copy
ActiveSheet.Select
ActiveSheet.Paste
sheetcount = sheetcount + 1
Next wks

End With
End Sub

"Fred" wrote:


I would like to create a macro that will all copy all of the worksheets in
the current workbook into the master workbook.

Please help me create this macro.

Thank you very much.


Chip Pearson

Copy Worksheets Into Master Workbook
 
Fred,
Try something like

Sub CopyTheSheets()

Dim DestWB As Workbook
Dim WS As Worksheet

Set DestWB = Workbooks("Master.xls")
For Each WS In ThisWorkbook.Worksheets
With DestWB.Worksheets
WS.Copy after:=.Item(.Count)
End With
Next WS

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Fred" wrote in message
...

I would like to create a macro that will all copy all of the worksheets in
the current workbook into the master workbook.

Please help me create this macro.

Thank you very much.




All times are GMT +1. The time now is 05:03 PM.

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