PDA

View Full Version : Excel-Copy worksheet and timestamp



athard
12-29-2010, 01:31 PM
How do I copy the existing content of a worksheet into a new tab and name it with a date and time stamp? The worksheet has a form in it. Is it possible to copy the template of the form without copying the values?

E.g.

Name: John Doe
Age: 29.

When you run the macro, it saves that page and values and then opens up a new tab called 2:15PM-12/29/10 and in that it will have:

Name:
Age:

Please advise.

Thank you.

Tinbendr
01-03-2011, 12:27 PM
Create a sheet named MyTemplate. (You can make it hidden if you like)

BTW, you can't use the colon or backslash in sheet name.

Sub AddSheet()
ActiveWorkbook.Worksheets("MyTemplate").Copy after:=Worksheets(1)
Worksheets(2).Name = Format(Time, "h.mmAMPM") & " - " & Format(Date, "mm-dd-yyyy")
End Sub


Name of sheet = 1.19PM - 01-03-2011

David