View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
PeterAtherton
 
Posts: n/a
Default Copy Sheets Macro

This copies sheet 1 t the back of the workbook

Sub NewSheets()
Dim nwks As Integer, newSheet As Worksheet
Dim nSheets As Integer, i As Integer
nSheets = InputBox("How many sheets do you want to copy?", _
"Number of sheets to insert")
Application.ScreenUpdating = False
For i = 1 To nSheets
nwks = Worksheets.Count
If nwks = 255 Then
MsgBox "You cannot have more than 255 worksheets!"
Exit Sub
End If

Sheets("Tab1").Copy After:=Sheets(nwks)
nwks = nwks + 1
Sheets(nwks).Name = "Tab" & nwks
Next
Application.ScreenUpdating = True
End Sub

Regards
Peter

"WBTKbeezy" wrote:

Help!

I have a workbook with 13 tabs. Sometimes we have a need to up that to over
40 more, but all the new tabs would just be a copy of the other ones.

So I need a macro that would easily allow me to Add A user defined number of
additional tabs each being a copy of one of the originals. Each Tab would
also need to be named in succession (i.e., Tab 13, copies and pastes as Tab
14, then Tab 15, then Tab 16, then Tab 17, etc... up to as many as the user
specifies. CAN ANYONE Help?