Reproduce same sheet multiple times

austin350s10

Active Member
Joined
Jul 30, 2010
Messages
321
Is there a way to program a single button so when clicked it takes a very hidden sheet, copies it and turns it into a new sheet? Only catch is it would need to change the sheet name each time it is clicked.

EXAMPLE WORKBOOK STRUCTURE:
(fresh workbook no button click)
MainPage(unhidden), FirstReport(unhidden), ReportTemplate(very hidden)

(first button click)
MainPage(unhidden), FirstReport(unhidden), Report-[CurrentDate](unhidden), ReportTemplate(very hidden)

(second button click)
MainPage(unhidden), FirstReport(unhidden), Report-[CurrentDate(unhidden), Report-[CurrentDate](unhidden), , ReportTemplate(very hidden)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
first prepare a macro and assign this macro to the button

the macro will be something like this (modify it to suit you)


Code:
Sub test()
Dim x As String
Application.ScreenUpdating = False
x = InputBox("type the name you want to give to the new sheet for e.g. austin1    ")
Sheets("Sheet1").Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = x
Application.ScreenUpdating = True
End Sub
 
Upvote 0
assign this to a button in your main sheet:

Code:
Sub CopyTemplate()
Dim lngCalc As Long

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
        lngCalc = .Calculation
        .Calculation = xlCalculationManual
    End With
    
    Sheet2.Visible = xlSheetVisible
    Sheet2.Copy after:=Sheets(Sheets.Count)
    ActiveSheet.Name = "Report - " & Format(Now(), "mm-dd-yy")
    Sheet2.Visible = xlSheetVeryHidden
    
    With Application
        .ScreenUpdating = True
        .EnableEvents = True
        .Calculation = lngCalc
    End With
End Sub

NOTE: this assumes the veryhidden sheet has the object name "Sheet2". This will need to be changed based on your template sheet object name.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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