Copy Worksheets Into Master Workbook

G

Guest

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.
 
G

Guest

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
 
C

Chip Pearson

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top