How to run a macro from our sample workbookĪlternatively, you can download our sample workbook to Duplicate Excel Sheets and run the code from there. On the left pane, right-click ThisWorkbook, and then click Insert > Module.įor the detailed step-by-step instructions, please see How to insert VBA code in Excel.Press Alt + F11 to open the Visual Basic Editor. ![]() To insert the code in your workbook, perform these steps: To copy a sheet in Excel with one of the above macros, you can either insert the VBA code into your own book or run a macro from our sample workbook. How to duplicate sheets in Excel with VBA Open the original sheet, run the macro, specify how many copies of the active sheet you want to make, and click OK: ![]() N = InputBox("How many copies of the active sheet do you want to make?")ĪctiveSheet.Copy After:=ActiveWorkbook.Sheets(Worksheets.Count)
0 Comments
Leave a Reply. |