Or this which copies template to the end. Private Sub Workbook_Open() Dim mydate As String mydate = Format(Date, "dd-mm-yyyy") With Sheets(Sheets.Count) If .Name <> mydate Then Sheets("Template").Copy after:=Sheets(.Index) ActiveSheet.Name = mydate End If End With End Sub
Don Guillett SalesAid Software dguille...@gmail.com From: Paul Schreiner Sent: Wednesday, February 29, 2012 6:42 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Copy Sheet and Name the sheet with todays date First: save your file as .xlsb or .xlsm... Then create a Workbook Open event macro in the Thisworkbook module: Private Sub Workbook_Open() Dim Sht Err.Clear On Error Resume Next Sht = Format(Now(), "dd-mmm-yy") Sheets(Sht).Select If (Err) Then Sheets("TEMPLATE").Copy Before:=Sheets(1) ActiveSheet.Name = Sht End If End Sub The macro turns off the Error handler so that selecting a sheet that doesn't exist will not halt the program. This macro then creates a sheet name in the format of "dd-mmm-yy" it then tries to select the sheet with this name. If the sheet doesn't exist, the error code will be set. If an error occurred, then the Template is copied (to the first sheet of the workbook) and renamed to the date string. If an error did NOT occur, then of course, the daily sheet will be active. hope this helps. Paul ----------------------------------------- “Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.” - John Wesley ----------------------------------------- -------------------------------------------------------------------------------- From: Sundarvelan N <nsund...@gmail.com> To: excel-macros@googlegroups.com Sent: Wed, February 29, 2012 6:26:38 AM Subject: $$Excel-Macros$$ Copy Sheet and Name the sheet with todays date Hi Friends, I need a help in my project. I have excel file in which template sheet is constant. When i open that file in the morning it should copy the template sheet and rename the sheet with todays date. In the same day i will be closing and opening that file many times but it should not insert every time i open in a same day. Thanks N.Sundarvelan 9600160150 -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com