VBA - Copy and create identical sheets except name of sheet.

X_Nemo

New Member
Joined
Mar 18, 2015
Messages
12
Hi Forum,

It's a pleasure joining your forum and I hope that you can answer my question or atleast give some input.

I need to make a lot of sheets with different name but the same functions and formating.

Let me try to split the problem up in more two parts.
1) Create sheets with name of values in cells marked:
I already got a macro to fix this from the internet.
Code:
Sub AddSheets() 'Select range and make x sheets with the names in range
Dim cell As Excel.Range
Dim wbToAddSheetsTo As Excel.Workbook

Set wbToAddSheetsTo = ActiveWorkbook
For Each cell In Selection
    With wbToAddSheetsTo
        .Sheets.Add after:=.Sheets(.Sheets.Count)
        On Error Resume Next
        ActiveSheet.Name = cell.Value
        If Err.Number = 1004 Then
          Debug.Print cell.Value & " already used as a sheet name"
        End If
        On Error GoTo 0
    End With
Next cell
End Sub

2) Copy the content (of maybe a template sheet) onto all the sheets:
It need to, in some way, copy all information and formating from a template sheet onto all the sheets.


I don't know if this can be done in one step or it have to be done in two steps.
Looking forward to hear from anyone.
Please ask if anything isn't clear and I need to elaborate

Best regards,
X_Nemo
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi X_Nemo

Should be quite easy.

Instead of
Code:
.Sheets.Add after:=.Sheets(.Sheets.Count)

try
Code:
.Sheets("[B][I]Template sheet name[/I][/B]".Copy after:=.Sheets(.Sheets.Count)

Peace
R
 
Upvote 0

Forum statistics

Threads
1,216,115
Messages
6,128,919
Members
449,478
Latest member
Davenil

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