Copy a sheet and rename it

G

Guest

Can someone please show me what I am stupidly missing:

I want to make a copy of a very hidden sheet named LogTemplate and position
it after the sheet named LOG (visible). Rename the copy as Log Future # where
# is the next number in sequence. So if Log Future 1 already exists, name the
new one Log Future 2, and so on...

I won't post my code (unless someone requests it) since it is useless any way.

Thanks much in advance for your assistance.
 
G

Guest

try unhiding the sheet.
copy it
rename it
then hide it again
or is that what you are needing help with?
 
B

Bob Phillips

Dim i As Long
Dim sh As Worksheet

i = 0
On Error Resume Next
Do
Set sh = Nothing
i = i + 1
Set sh = Worksheets("Log Future " & i)
Loop Until sh Is Nothing
On Error GoTo 0

Worksheets("Sheet2").Copy after:=Worksheets("Log")
ActiveSheet.name = "Log Future " & i


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Top