View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Copy tab ? times

Hi ,
try

''' --------------------------
Sub CopyTabN(Wsh as Worksheet, N as long)
Dim wshTo As Worksheet
Dim i As Long

Set wshTo = wsh
For i = 1 To n
wsh.Copy After:=wshTo
Set wshTo = wshTo.Parent.Worksheets(wshTo.Index + 1)
wshTo.Name = wsh.Name & " " & i
Next

End Sub
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"JohnUK" wrote:

Hi, I am after a short piece of code that can copy a sheet/tab, amount to be
determined by a number in a given cell, and rename the tabs. For example: If
the page that I want copied had the number 50 in Cell A1, I want the tab to
be copied 50 times and numbered sequentially (1 to 50)
Is this possible
Many thanks for help
John