ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adding copies of a master (https://www.excelbanter.com/excel-discussion-misc-queries/149149-adding-copies-master.html)

kmaki

Adding copies of a master
 
Within a workbook, is it possible to insert multiple copies of worksheets at
one time? I have a master and need to insert 20 copies within the workbook
to enter employee data.

Thanks.

Gord Dibben

Adding copies of a master
 
How would you like to name those copied sheets?

You could put a list of names in a sheet called "List"

Say newsheet1, newsheet2, newsheet3 down to A20 then run this macro from Dave
Peterson.

Sub CreateNameSheets()
' by Dave Peterson
' List sheetnames required in col A in a sheet: List
' Sub will copy sheets based on the sheet named as: Master
' and name the sheets accordingly

Dim TemplateWks As Worksheet
Dim ListWks As Worksheet
Dim ListRng As Range
Dim myCell As Range

Set TemplateWks = Worksheets("Master")
Set ListWks = Worksheets("List")
With ListWks
Set ListRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In ListRng.Cells
TemplateWks.Copy After:=Worksheets(Worksheets.Count)
On Error Resume Next
ActiveSheet.Name = myCell.Value
If Err.Number < 0 Then
MsgBox "Please fix: " & ActiveSheet.Name
Err.Clear
End If
On Error GoTo 0
Next myCell

End Sub


Gord Dibben MS Excel MVP

On Thu, 5 Jul 2007 16:50:00 -0700, kmaki
wrote:

Within a workbook, is it possible to insert multiple copies of worksheets at
one time? I have a master and need to insert 20 copies within the workbook
to enter employee data.

Thanks.




All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com