In Excel: paste Sub CopySheet() into the VBA editor (Alt + F11 → Insert ▸ Module), press F5 to run, and save as .xlsm to keep the macro.
VBA macro: Copy Sheet
Sub CopySheet()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Copy After:=ws
ActiveSheet.Name = ws.Name & "_Copy"
End SubCopies the active sheet and places the copy immediately after it. Renames the copy by appending "_Copy" to the original name.
How to run this macro
- Press Alt + F11 to open the VBA editor.
- Insert > Module.
- Paste the code above.
- Press
F5, or close the editor and run it from Developer > Macros. - Save the file as .xlsm so the macro is kept.
Press Alt + F11 to open the Visual Basic for Applications editor.
In the Project pane, right-click the workbook name and choose Insert ▸ Module.
Paste the Sub CopySheet() code into the blank Module window.
Press F5 or click Run ▸ Run Sub/UserForm to execute the macro.
Save the workbook as Excel Macro-Enabled Workbook (.xlsm) to preserve the code.
What this does
The Copy Sheet macro lets you copy or duplicate a worksheet in Excel without repeating the steps by hand. Paste the Sub CopySheet() code into the VBA editor (Alt + F11 → Insert ▸ Module) and run it from Developer ▸ Macros or by pressing F5 inside the editor. Once the macro runs, Excel executes every step programmatically — what might take several manual passes through your data completes in a single click. Because the code is stored in the workbook, you can reuse the Copy Sheet macro any time the same task arises without rebuilding the steps from scratch. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. Treat “excel vba copy range to another sheet” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected sheet shows up while it is still harmless. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. That turns a workflow that saves repeating the same clicks every week into a method you can reuse, explain, and defend when the workbook leaves your screen.
A worked example
Example: a colleague sends you a large dataset and asks you to copy or duplicate a worksheet before handing it back. Open the VBA editor with Alt + F11, create a new Module, paste the Sub CopySheet() code, and click Run (or press F5). Excel calls the Sub, runs through the sheet, and finishes the Copy Sheet task automatically. The whole operation takes seconds regardless of how many rows are involved — and because the macro is deterministic, it will produce the same result every time you run it on the same input. Use Sub CopySheet() every time you need to copy or duplicate a worksheet reliably at scale. The macro eliminates the most common sources of error in manual work: missed rows, wrong column references, and inconsistent criteria. Once the code is tested and trusted, you can run it repeatedly with one click — zero cognitive overhead, zero variation in output. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.
In Google Sheets
Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. Keep this page bookmarked for the next time the same question comes up. Better still, rebuild the example once in your own sheet — doing it yourself, with the tool above to check against, is what turns a copied formula into a technique you own. Here is the takeaway for “excel vba copy range to another sheet”: copy the answer if you are busy, but if you have a spare few minutes, rebuild the example in Excel yourself with the tool above open beside it. That single pass — type it, run it, watch the result move when you change an input — is what turns a formula you found into a technique you trust. Keep your inputs labelled and referenced, never hard-coded, and the same sheet stays correct and auditable as it grows. Done that way, you will not need to look this up again, and you will be the person others ask.
Common mistakes
- Saving as .xlsx instead of .xlsm — Excel strips all VBA code when you save in the non-macro-enabled format. Always choose "Excel Macro-Enabled Workbook (.xlsm)" from the Save As dialog.
- Running the macro on the wrong sheet — Sub CopySheet() acts on ActiveSheet by default. If you have multiple sheets open, click the correct sheet tab first before pressing Run.
- Macros are disabled — if you see a security warning bar, click Enable Content. If there is no bar at all, set File ▸ Options ▸ Trust Center ▸ Trust Center Settings ▸ Macro Settings to "Disable VBA macros with notification", which is the safe default that still lets you approve a file per workbook. Do not select "Enable all macros": it removes the only warning you get before a hostile workbook executes.
Frequently asked questions
How do I run the Copy Sheet macro?
Press Alt + F11 to open the VBA editor, insert a Module (Insert ▸ Module), paste Sub CopySheet() into the code pane, and press F5. Alternatively close the editor and run it from Developer ▸ Macros ▸ select "CopySheet" ▸ Run.
Why won't my macro run — macros are disabled?
Excel blocks macros by default for files downloaded from the internet. Click the yellow security bar and choose "Enable Content" — that trusts this one workbook and is all that is normally needed. Leave File ▸ Options ▸ Trust Center ▸ Trust Center Settings ▸ Macro Settings on "Disable VBA macros with notification" rather than switching to "Enable all macros", which Microsoft itself marks not recommended. If the bar is red instead of yellow, the file carries Mark of the Web: close Excel, right-click the file, open Properties and tick Unblock. Also ensure the file is saved as .xlsm, not .xlsx.
Can I undo what the Copy Sheet macro did?
No — VBA actions generally cannot be undone with Ctrl+Z because they bypass Excel's undo stack. Always test Sub CopySheet() on a backup copy of the workbook before running it on live data, or add explicit validation logic inside the macro before the destructive step.