Create 45 Excel Worksheets with VBA and Increment Q1 Values
Question details
Create 45 copies of an Excel worksheet, set cell Q1 on each copied sheet to a different sequential number, and give every new worksheet a unique name.

- Product
- Microsoft Excel VBA
- Device & OS
- not provided
- Scenario
- The user needs to automate the creation of multiple worksheet copies from one original template sheet.
- Observed behavior
- The desired result is 45 newly created worksheets named sequentially, with Q1 containing values 1 through 45.
Save the workbook as an Excel Macro-Enabled Workbook (*.xlsm) and replace the source worksheet name in the macro with the exact name of your template sheet. Ensure that the NewSheet_1 through NewSheet_45 names are not already used in the workbook.
Run a VBA macro to copy the template sheet 45 times
Use this method when you want Excel to duplicate one existing worksheet, number cell Q1 on each copy, and apply predictable worksheet names automatically.
The macro copies the selected source sheet to the end of the workbook during each loop. It then writes the loop number to Q1 and renames the active copied sheet as NewSheet_1 through NewSheet_45.
In Excel, press Alt+F11 to open the Visual Basic Editor. Select your workbook in the Project pane, then choose Insert > Module.
Paste the following code into the new module, replacing "OriginalSheetName" with your actual template worksheet name: Sub CopyWorksheetsAndIncrement() Dim wsOriginal As Worksheet Dim wsNew As Worksheet Dim i As Long Set wsOriginal = ThisWorkbook.Worksheets("OriginalSheetName") For i = 1 To 45 wsOriginal.Copy After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count) Set wsNew = ActiveSheet wsNew.Range("Q1").Value = i wsNew.Name = "NewSheet_" & i Next i End Sub
Place the cursor anywhere inside CopyWorksheetsAndIncrement, then press F5 or choose Run > Run Sub/UserForm. Excel creates 45 copies after the last worksheet in the workbook.
Check that the new tabs are named NewSheet_1 through NewSheet_45 and open a few sheets to confirm that cell Q1 contains the matching number.

Use a different worksheet naming prefix when names already exist
Use this adjustment if Excel displays a duplicate-name error because NewSheet_1 or another generated name is already present.
Copy and Number Template Worksheets with WPS Spreadsheet VBA
WPS Spreadsheet provides a familiar worksheet interface for opening macro-enabled workbooks and managing repeated sheet-copy tasks. You can use a VBA-compatible macro workflow to duplicate a template sheet, update Q1 with sequential values, and organize the resulting worksheets efficiently.
- 1. Open the macro-enabled workbook: Open the XLSM workbook in WPS Spreadsheet and confirm that the template worksheet is available.
- 2. Access macro tools: Go to the Developer tab and open the Visual Basic or Macro tools available in your WPS Spreadsheet installation.
- 3. Insert the worksheet-copy macro: Create a module, paste the macro, and replace OriginalSheetName with the name of your template sheet.
- 4. Run the macro: Run CopyWorksheetsAndIncrement from the Macro dialog or the VBA editor to generate the numbered worksheet copies.

Frequently Asked Questions
Where do I change the original worksheet name in the macro?
Edit the text inside Set wsOriginal = ThisWorkbook.Worksheets("OriginalSheetName"). Replace OriginalSheetName with the exact worksheet tab name, including spaces if the tab contains them.
Why does the macro stop with a worksheet name error?
A generated name such as NewSheet_1 may already exist, or the name may contain unsupported characters. Rename existing sheets, delete conflicting tabs, or change the "NewSheet_" prefix in the wsNew.Name line.
Will the copied worksheets keep formulas, formatting, and charts?
Yes. Worksheet.Copy duplicates the source worksheet, including its cell values, formulas, formatting, charts, and most sheet-level settings. The macro then changes only Q1 and the worksheet name.
How can I start the numbering at a number other than 1?
Change For i = 1 To 45 to the range you need. For example, use For i = 101 To 145 to write 101 through 145 into Q1 and create correspondingly numbered sheet names.




