ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copying worksheets (https://www.excelbanter.com/excel-discussion-misc-queries/3078-copying-worksheets.html)

tea1952

copying worksheets
 
can you copy worksheets without doing it one at a time if you want like 50
worksheets that are all the same in the same workbook?

Jim Rech

I'd use a macro. A simple example:

Sub DupSheet()
Dim Counter As Integer
Application.ScreenUpdating = False
For Counter = 1 To 50
ActiveSheet.Copy , Worksheets(ActiveWorkbook.Sheets.Count)
ActiveSheet.Name = "Sheet" & Counter + 1 ''Modify as needed
Next
End Sub

--
Jim Rech
Excel MVP
"tea1952" wrote in message
...
| can you copy worksheets without doing it one at a time if you want like 50
| worksheets that are all the same in the same workbook?



John Mansfield

The only way that I know of to do this would be to use VBA. Assuming your
workbook contains only one sheet called "Sheet1", try:

Sub CopySheet()
Application.ScreenUpdating = False
Dim cnt As Integer
cnt = 1
Do Until cnt = 50
On Error Resume Next
Sheets("Sheet1").Copy Befo=Sheets(cnt)
Sheets(cnt).Name = "Sheet" & cnt + 1
cnt = cnt + 1
Loop
End Sub

----
Regards,
John Mansfield


"tea1952" wrote:

can you copy worksheets without doing it one at a time if you want like 50
worksheets that are all the same in the same workbook?



All times are GMT +1. The time now is 05:55 PM.

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