![]() |
Rename new worksheet with the current date
I have a workbook that I do not use every day, but when I use it I need to
copy the contents of the last sheet to a new worksheet and then name the new sheet with the current date. What I have now is very simple, since the worksheet I want to copy is always the active sheet I just used the following: ActiveSheet.Copy After:=ActiveSheet Now I want to name the new sheet whatever the current date is. Any ideas? -- Whether you think you can or cannot, you are right. - Henry Ford |
Rename new worksheet with the current date
Sub copysheetandnamedate()
myname = Format(Date, "mm-dd-yy") ActiveSheet.Copy After:=ActiveSheet ActiveSheet.Name = myname End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Jeff Parrott" wrote in message ... I have a workbook that I do not use every day, but when I use it I need to copy the contents of the last sheet to a new worksheet and then name the new sheet with the current date. What I have now is very simple, since the worksheet I want to copy is always the active sheet I just used the following: ActiveSheet.Copy After:=ActiveSheet Now I want to name the new sheet whatever the current date is. Any ideas? -- Whether you think you can or cannot, you are right. - Henry Ford |
Rename new worksheet with the current date
Hello Jeff, Once the sheet is copied, it becomes the ActiveSheet. This examples names the new sheet "31-dec-2008". Code: -------------------- ActiveSheet.Copy After:=ActiveSheet ActiveSheet.Name = Format(Now(), "dd-mmm-yyyy") -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45238 |
Rename new worksheet with the current date
Sub fhjskaf()
ActiveSheet.Name = Format(Date, "mmm_dd_yyyy") End Sub -- Gary''s Student - gsnu200822 "Jeff Parrott" wrote: I have a workbook that I do not use every day, but when I use it I need to copy the contents of the last sheet to a new worksheet and then name the new sheet with the current date. What I have now is very simple, since the worksheet I want to copy is always the active sheet I just used the following: ActiveSheet.Copy After:=ActiveSheet Now I want to name the new sheet whatever the current date is. Any ideas? -- Whether you think you can or cannot, you are right. - Henry Ford |
Rename new worksheet with the current date
After the Activesheet gets copied, the copy now becomes the Activesheet.
ActiveSheet.Copy After:=ActiveSheet ActiveSheet.Name = Format(Date, "mmddyyyy") Gord Dibben MS Excel MVP On Tue, 30 Dec 2008 10:58:05 -0800, Jeff Parrott wrote: I have a workbook that I do not use every day, but when I use it I need to copy the contents of the last sheet to a new worksheet and then name the new sheet with the current date. What I have now is very simple, since the worksheet I want to copy is always the active sheet I just used the following: ActiveSheet.Copy After:=ActiveSheet Now I want to name the new sheet whatever the current date is. Any ideas? |
Rename new worksheet with the current date
Thanks, all of you. I actually sort of used a combination of everything and
came up with: Sub copysheet() ActiveSheet.Copy After:=ActiveSheet ActiveSheet.Name = Format(Date, "mm-dd-yyyy") End Sub It works just like I wanted it to. Thanks! -- Whether you think you can or cannot, you are right. - Henry Ford "Leith Ross" wrote: Hello Jeff, Once the sheet is copied, it becomes the ActiveSheet. This examples names the new sheet "31-dec-2008". Code: -------------------- ActiveSheet.Copy After:=ActiveSheet ActiveSheet.Name = Format(Now(), "dd-mmm-yyyy") -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45238 |
All times are GMT +1. The time now is 05:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com