Copying Excel Sheet Multiple Times

Zedrick13

Board Regular
Joined
Sep 8, 2018
Messages
100
Is there faster way of creating multiple copies of a certain sheet on the same workbook rather than the conventional way of copy a sheet one at a time?

Regards,
Zed
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
.
There are a number of ways to accomplish the goal. Here is one.

Save a workbook with just one sheet named TEMPLATE.

In A1 enter "New Sheet Name"
In A2 is the location where you will enter the name of the new sheet you are adding.
Place a command button on the TEMPLATE sheet connect to the macro below.

You can create one new sheet at a time. The


Code:
Option Explicit


Sub CreateNew()
Dim wsRecipes As Worksheet, wsTEMP As Worksheet, wasVISIBLE As Boolean
Dim shNAMES As Range, Nm As Range
Dim i As Long
Dim wsIndex
On Error Resume Next




With ThisWorkbook                                               'keep focus in this workbook
Application.CopyObjectsWithCells = False
    Set wsTEMP = .Sheets("Template")                            'sheet to be copied
    wasVISIBLE = (wsTEMP.Visible = xlSheetVisible)              'check if it's hidden or not
    If Not wasVISIBLE Then wsTEMP.Visible = xlSheetVisible      'make it visible
      
    Application.ScreenUpdating = False                          'speed up macro


    wsTEMP.Copy After:=.Sheets(.Sheets.Count)                   '...create it from template
    
    wsIndex.Activate                                            'return to the master sheet
    If Not wasVISIBLE Then wsTEMP.Visible = xlSheetHidden       'hide the template if necessary
    Application.ScreenUpdating = True                           'update screen one time at the end


Application.CopyObjectsWithCells = True
End With
Sheets(Sheets.Count).Select


Dim tabname As String
tabname = Sheets("Template").Range("A2").Value
ActiveSheet.Name = tabname
ActiveSheet.Range("A1:A2").Value = ""
Sheets("Template").Range("A2").Value = ""
MsgBox "New sheet created. "
End Sub
 
Upvote 0
Try this:

This script assumes you want to make copies of a sheet named "Master"
Modify as needed.

Code:
Sub Copy_Sheets()
'Modified 1/21/2019 9:34:49 PM  EST
Application.ScreenUpdating = False
Dim i As Long
Dim ans As Long
ans = InputBox("Enter number copies you want")
    For i = 1 To ans
        Sheets("Master").Copy After:=Sheets(Sheets.Count)
        ActiveSheet.Name = "Master" & ActiveSheet.Index
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top