Yes, VBA can copy a worksheet into a brand-new workbook in a single line of code. The core statement is Worksheets("Sheet1").Copy, which moves the sheet into a fresh workbook when no destination is given, or into a specified workbook when one is. Your macro workbook must be saved as a macro-enabled file (`.xlsm`) first, and you need a module to hold the code. Below is a working two-line approach, then a more careful version that handles names, formulas and formatting correctly.
What You'll Need
- The workbook containing the sheet you want to copy, saved as an Excel Macro-Enabled Workbook (`.xlsm`), since `.xlsx` files cannot store macros.
- A standard module in the Visual Basic Editor. Macros in a worksheet module or in
ThisWorkbookstill run, but a standard module keeps your code easy to find. - Macros enabled in your Excel Trust Center settings. If macros are disabled, your code will not run at all.
- Basic comfort with editing a name in one line of code and pressing F5 to run it. No prior VBA experience is required for the simple version.
Step-by-Step
- Open the Visual Basic Editor. In Excel press
Alt+F11(on Mac:Option+F11). The editor opens in a separate window. - Insert a standard module. In the editor choose
Insert > Module. A blank code window appears. Exact menu labels vary slightly by Excel version and by whether you are on Windows or Mac, but the Insert menu always holds Module. - Write a simple macro. Type the following, replacing
SourceSheetwith the sheet name as it appears on the tab:
TheSub CopyOneSheet() ThisWorkbook.Worksheets("SourceSheet").Copy ActiveWorkbook.SaveAs "C:\Reports\SourceSheet.xlsx" End Sub.Copyline with no argument creates a new workbook that contains only that sheet. The next line saves it where you choose. Change the path and filename to a location that exists — a folder that does not exist will raise an error. - Run the macro. Press
F5with the cursor inside the routine. If you want a clickable button instead, pressAlt+F8from Excel, or assign the macro to a shape or button on a sheet. - Handle formulas and formatting. A plain copy keeps values, formulas and number formats, but formulas that point at other sheets in the source workbook will resolve differently in the new one. If you only want the values, use
PasteSpecialinstead of a straight copy:
The middle line flattens formulas to their current results before the sheet goes to the new file.Sub CopyValuesOnly() Dim src As Worksheet, dst As Worksheet Set src = ThisWorkbook.Worksheets("SourceSheet") src.Copy Before:=ThisWorkbook.Worksheets(1) Set dst = ThisWorkbook.Worksheets(1) dst.UsedRange.Value = dst.UsedRange.Value dst.Copy ActiveWorkbook.SaveAs "C:\Reports\ValuesOnly.xlsx" End Sub - Copy several sheets at once, if needed. Pass an array of names to keep them together in one new workbook:
The sheets keep the order you list them. The call only works if every name exists; one typo stops the whole line.Sub CopySeveral() ThisWorkbook.Worksheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy ActiveWorkbook.SaveAs "C:\Reports\Combined.xlsx" End Sub - Point at a named file rather than relying on ActiveWorkbook. If other workbooks are open,
ActiveWorkbookcan grab the wrong file. Save the new workbook to a variable instead:Sub CopyToNewFile() Dim wbNew As Workbook ThisWorkbook.Worksheets("SourceSheet").Copy Set wbNew = ActiveWorkbook wbNew.SaveAs "C:\Reports\SourceSheet.xlsx", FileFormat:=51 End SubFileFormat:=51saves as a standard `.xlsx` workbook. - Test on a copy of your file. Run the macro once on a duplicate of your workbook. Check that the new file opens, that the sheet name and tab order are right, and that any formulas still show the numbers you expect. Then run it on the live file.
Common Mistakes
Saving as `.xlsx` while keeping macros in the source. If you want the new file to also run macros, save as `.xlsm` with FileFormat:=52 instead of 51. A `.xlsx` saved from a macro workbook cannot carry the code forward.
Using a sheet name that does not exist. Sheet names in code are exact, including spaces. Worksheets("Sales 2026") fails if the tab is really called Sales2026, or if it is a sheet named after a variable rather than a literal string. Use the exact text shown on the tab.
Leaving ActiveWorkbook unguarded. With several workbooks open, Excel may make a different one active. Always capture the new workbook to a variable as shown in step 7.
Assuming the new workbook keeps links to the old one. External references in formulas still point at the original file path, so the workbook will raise update links prompts when opened elsewhere. Replace or remove those links deliberately.
Copying a hidden or very hidden sheet. A straight .Copy of a hidden sheet can fail; unhide it first, or set Visible = xlSheetVisible in code before copying.
Tips
Turn off screen updating around the copy — Application.ScreenUpdating = False at the start and back to True at the end — so Excel does not flicker while it builds the new workbook.
To avoid name collisions, build a timestamped filename such as "Report_" & Format(Now(), "yyyymmdd_hhmm") & ".xlsx". This keeps repeat runs from overwriting the previous output.
Wrap the save in an error handler so an unexpected open file or bad path gives a clear message rather than a raw runtime error:
On Error GoTo failed
' copy and save code here
Exit Sub
failed:
MsgBox "Could not save: " & Err.Description
End Sub
Use Worksheets.Count and a loop if you want to copy every sheet, rather than naming each one. Copying all sheets is the same as copying the whole workbook minus its macros, so it can replace a manual "Save As" routine.
Set wbNew.Sheets("Sheet1").Name = "Report" after saving if the new file needs a fixed tab name, so whatever the source sheet was called, the output is consistent.
Troubleshooting
Nothing happens when you press F5. The cursor is probably not inside the procedure. Click inside the Sub ... End Sub block, or pick the macro name from the list. Also confirm macros are enabled in Trust Center.
Run-time error 9: Subscript out of range. The sheet name does not match any tab. Check spelling, spaces and whether the sheet is in the workbook you think it is in.
Run-time error 1004. This usually means a bad path or filename, a name that already exists and is open, or an invalid character such as * ? : \ / | in the filename. Simplify the name and confirm the folder exists.
The new file opens blank or with a warning. This is often the protected view for files in a downloaded or untrusted folder. Save to a normal local folder and try again.
The copy is slower than expected. If the source sheet has a large used range, clear formatting from empty rows and columns first — pressing Ctrl+End on the sheet shows where Excel thinks the data ends.
Frequently Asked Questions
Does Copy create a new workbook automatically?
Yes. Called with no destination, Worksheet.Copy places the sheet alone into a new workbook and makes it the active workbook. Call it with Before:= or After:= to copy into an existing workbook instead.
Can I copy a sheet without copying its formulas?
Not directly. Copy the sheet first, then overwrite its used range with its own values to flatten formulas, as shown in step 5, and save that result.
Why does the new workbook ask about links?
Formulas that refer to other sheets or files still point at their original source. Open the new file and use Excel's Edit Links option to change or break those links before sending the file on.
Can I copy a worksheet to a new workbook from a macro in a different file?
Yes. Qualify the source explicitly, for example Workbooks("Source.xlsx").Worksheets("Sheet1").Copy. The workbook must already be open, or you must open it first.
Does this work on Mac?
Yes, with the same object model. The main differences are the shortcut key for the editor and the default file separator in paths. Mac uses : in older VBA paths rather than a backslash, so test your save path on the target machine.