Solved

Make multiple copies of a worksheet in an Excel file

Posted on 2014-03-26
4
250 Views
Last Modified: 2014-03-27
I have an Excel file with one worksheet named "Sheet1". Sheet1 contains a "shell".  I need the file to contain 20 copies of Sheet1 and the tabs to be named by the numbers 1 through 20.  In other words, rename Sheet1 to "1" and make 19 additional copies of it numbered 2 through 20. The expected result is an Excel file with 20 tabs numbered 1 through 20; each containing a copy of the "shell" from Sheet1.
0
Comment
Question by:dbfromnewjersey
4 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39956771
Hi,

pls try

Sub macro()
Dim sh As Sheets
For Idx = 2 To 21
    Sheets(1).Copy after:=Sheets(Idx - 1)
    Sheets(Idx).Name = Idx - 1
Next
Sheets(1).Delete

End Sub

Open in new window

Regards
0
 
LVL 39

Accepted Solution

by:
nutsch earned 350 total points
ID: 39956779
This code should do exactly that:
Sub Macro1()
'
Dim lLoop As Long

For lLoop = 2 To 20
    Sheets("Sheet1").Copy After:=Sheets(Sheets.Count)
    ActiveSheet.Name = lLoop
Next lLoop

Sheets("Sheet1").Name = "1"

End Sub

Open in new window

0
 
LVL 6

Expert Comment

by:vmagan
ID: 39956781
You can also right click on the sheet name and click on move and copy. You will be able to copy it there.
0
 
LVL 13

Assisted Solution

by:Santosh Gupta
Santosh Gupta earned 150 total points
ID: 39956798
Try this...

if you want to put some specific name you can user below Macro.

"LIST" - name of sheets
"Template" -your actual sheet.
Sub CreateSheets()
    Dim i As Long
    Dim ws As Worksheet
    Dim ws1 As Worksheet
    
        Set ws = Sheets("LIST")
        Set ws1 = Sheets("Template")
        
        For i = 2 To ws.Cells(Rows.Count, "A").End(xlUp).Row
            ws1.Copy After:=Sheets(Sheets.Count)
            With ActiveSheet
                .Name = ws.Cells(i, "A").Value
               End With
        Next i
        
End Sub

Open in new window

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
excel formula if this do this otherwise do this 2 16
Excel 2010 - Delete Row based on date 8 34
VBA Help 18 42
Excel Question 17 15
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now