How to copy sheets to another workbook using vba?

calendar_today Asked Jul 28, 2011
thumb_up 31 upvotes
history Updated April 16, 2026

Question posted 2011 · +14 upvotes

So, what I want to do, generally, is make a copy of a workbook. However, the source workbook is running my macros, and I want it to make an identical copy of itself, but without the macros. I feel like there should be a simple way to do this with VBA, but have yet to find it. I am considering copying the sheets one by one to the new workbook, which I will create. How would I do this? Is there a better way?

Accepted answer +31 upvotes

I would like to slightly rewrite keytarhero’s response:

Sub CopyWorkbook()

Dim sh as Worksheet,  wb as workbook

Set wb = workbooks("Target workbook")
For Each sh in workbooks("source workbook").Worksheets
   sh.Copy After:=wb.Sheets(wb.sheets.count) 
Next sh

End Sub

Top excel-vba Q&A (6)

+31 upvotes ranks this answer #7 out of 136 excel-vba solutions on this site — top 5%.