Re: $$Excel-Macros$$ Copy Sheet and Name the sheet with todays date
Thank you so much Thanks N.Sundarvelan 9600160150 On Wed, Feb 29, 2012 at 8:05 PM, dguillett1 dguille...@gmail.com wrote: Or this which copies template to the end. Private Sub Workbook_Open() Dim mydate As String mydate = Format(Date, dd-mm-) 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 schreiner_p...@att.net *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.
$$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 Template.xlsx Description: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
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. ThanksN.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
Re: $$Excel-Macros$$ Copy Sheet and Name the sheet with todays date
Dear Sundar, Wrong attachment, Please ignore it.. On Wed, Feb 29, 2012 at 6:21 PM, NOORAIN ANSARI noorain.ans...@gmail.comwrote: Dear Sundar, Please see attached sheet, you can use.. Sub Count_VBA() On Error Resume Next c = 1 For Each Sh In ActiveWorkbook.Sheets If Sh.Name Sheets(Summary) Then Sheets(Summary).Cells(2, B).Value = Sheets(Summary).Cells(2, B).Value + Application.WorksheetFunction.CountA(Sh.Range(C:C)) Sheets(Summary).Cells(3, B).Value = Sheets(Summary).Cells(3, B).Value + Application.WorksheetFunction.CountIf(Sh.Range(C:C), Driver) + Application.WorksheetFunction.CountIf(Sh.Range(C:C), Sweeper) End If c = c + 1 Next Sheet9.Cells(2, B).Value = Sheet9.Cells(2, B).Value - c On Error GoTo 0 End Sub -- Thanks regards, Noorain Ansari *http://noorainansari.com/* http://excelmacroworld.blogspot.com/ *http://excelmacroworld.blogspot.com/*http://excelmacroworld.blogspot.com/ On Wed, Feb 29, 2012 at 4:56 PM, Sundarvelan N nsund...@gmail.comwrote: 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 -- Thanks regards, Noorain Ansari *http://noorainansari.com/* http://excelmacroworld.blogspot.com/ *http://excelmacroworld.blogspot.com/*http://excelmacroworld.blogspot.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
Re: $$Excel-Macros$$ Copy Sheet and Name the sheet with todays date
Or this which copies template to the end. Private Sub Workbook_Open() Dim mydate As String mydate = Format(Date, dd-mm-) 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