Auto duplicating a sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have just completed working on a sheet and now need to make copies of it. I
know I can right click on the sheet tab and select copy however I need 42
sheets. Is there a way to program XL to create 42 copies of the worksheet. I
am not real familuar with VBE but with help can work through it.

Thanks
 
Hi

yes, this can be done via VBA, however, if you'ld like to let us know how
you would like your 42 sheets named we can incorporate this in the code.

Cheers
JulieD
 
Hi

okay modifying Jim's code - to give sheet names as well
Public Sub Duplicate()
Dim wks As Worksheet
Dim intCounter As Integer

j = DateValue("26/8/05")
Set wks = ActiveSheet
For intCounter = 1 To 42
wks.Copy , wks
j = j + 7
k = j + 7
ActiveSheet.Name = Format(j, "mmm dd") & " - " & Format(k, "mmm dd")
Next intCounter
End Sub

----
to use the code, right mouse click on the sheet tab - choose view code,
choose insert / module from the menu & copy & paste the code to the right
hand side of the screen. Switch back to your workbook and choose Tools /
Macro / Macros - Duplicate and press the RUN button.
(Please try this on a copy of your workbook first)

Regards
JulieD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top