Worksheet name from list

dave bates

Board Regular
Joined
Jul 7, 2008
Messages
106
Hi, help please with creating worksheets in a workbook

Im using Excel 2016

I have a VB to create new worksheets based on a list of names on a summary sheet but I would like the new worksheets to be to set layout including column widths, formats and formula. Is the easiest way to do this to extend the VBA to do a copy and paste special to all of the sheets when created.

The VBA that I'm using to create the worksheets is

Sub AddNamedSheets()
Dim i&
With sheets ("Sheet1")
For i = 52 To 2 Step-1
sheets.Add.Name=.Cells(i,"A").Value
Next i
End With
End Sub

thanks
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi, how about copying a "master" sheet that already has the layout, formulas etc rather than creating new sheets and back applying.

Something like this, where, for example, the name of the pre-formatted sheet is "master"

Rich (BB code):
Sub AddNamedSheets()
Dim i&
Application.ScreenUpdating = False
With Sheets("Sheet1")
    For i = 52 To 2 Step -1
        Sheets("master").Copy Before:=Sheets(1)
        ActiveSheet.Name = .Cells(i, "A").Value
    Next i
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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