Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
naming sheets
is there a way to name sheets with a date using a macro?
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
naming sheets
Worksheets(1).Name = Format$(Date, "mmddyy") -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "jhyatt" wrote in message is there a way to name sheets with a date using a macro? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
naming sheets
Something like:
Sub dateit() ActiveSheet.Name = Format(Date, "dd_mm_yyyy") End Sub change the format to suit your needs -- Gary''s Student - gsnu200749 "jhyatt" wrote: is there a way to name sheets with a date using a macro? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
naming sheets
I have this code to add asheet with a2 as the date is it possible to do it
this way Sub AddNewSheet() Dim SheetName As String SheetName = Range("A2") Sheets(5).copy After:=Sheets(Sheets.Count) On Error GoTo ErrHandler: ActiveSheet.Name = SheetName Exit Sub ErrHandler: MsgBox SheetName & " is not a valid sheet name or is already used." End Sub "Gary''s Student" wrote: Something like: Sub dateit() ActiveSheet.Name = Format(Date, "dd_mm_yyyy") End Sub change the format to suit your needs -- Gary''s Student - gsnu200749 "jhyatt" wrote: is there a way to name sheets with a date using a macro? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
naming sheets
Your approach can be made to work. However, as you pointed out in the code,
you need to do an error check in case Range("A2").Value is not a legal sheetname or has aleady been used -- Gary''s Student - gsnu200749 "jhyatt" wrote: I have this code to add asheet with a2 as the date is it possible to do it this way Sub AddNewSheet() Dim SheetName As String SheetName = Range("A2") Sheets(5).copy After:=Sheets(Sheets.Count) On Error GoTo ErrHandler: ActiveSheet.Name = SheetName Exit Sub ErrHandler: MsgBox SheetName & " is not a valid sheet name or is already used." End Sub "Gary''s Student" wrote: Something like: Sub dateit() ActiveSheet.Name = Format(Date, "dd_mm_yyyy") End Sub change the format to suit your needs -- Gary''s Student - gsnu200749 "jhyatt" wrote: is there a way to name sheets with a date using a macro? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
naming sheets
so how would we get it to work?
thank you "Gary''s Student" wrote: Your approach can be made to work. However, as you pointed out in the code, you need to do an error check in case Range("A2").Value is not a legal sheetname or has aleady been used -- Gary''s Student - gsnu200749 "jhyatt" wrote: I have this code to add asheet with a2 as the date is it possible to do it this way Sub AddNewSheet() Dim SheetName As String SheetName = Range("A2") Sheets(5).copy After:=Sheets(Sheets.Count) On Error GoTo ErrHandler: ActiveSheet.Name = SheetName Exit Sub ErrHandler: MsgBox SheetName & " is not a valid sheet name or is already used." End Sub "Gary''s Student" wrote: Something like: Sub dateit() ActiveSheet.Name = Format(Date, "dd_mm_yyyy") End Sub change the format to suit your needs -- Gary''s Student - gsnu200749 "jhyatt" wrote: is there a way to name sheets with a date using a macro? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA Help naming sheets | Excel Discussion (Misc queries) | |||
Naming Sheets for day of the month | Excel Discussion (Misc queries) | |||
Automatically naming sheets | Excel Programming | |||
naming sheets | Excel Programming | |||
Naming Workbooks and Sheets | Excel Programming |