Insert Current Date on a Sheet 1 Tab

V

Veronica

Good morning.

I have been trying to put a macro in place that will rename Sheet 1 tab to
the current date, every day, in many different new workbooks created daily.
I know the function =TODAY() however I can't seem to get that function to
take on the tab itself. I see that you can Insert an Excel Macro on the tab,
but I don't know how to create this either. I can get the Tab to read Macro1
- but then I don't know how to write that Macro.

I appreciate any input!
 
F

FSt1

hi
you can't name a sheet by a date because you can't use traditions date
seperators in the name.
these characters are forbidden by excel
:, /, \, *,[ ,]
you can name it with someting that looks like a date like'
2-12-2008 or Feb-12-2008
and that can be done with a macro.
Dim td As Date
Dim d As Long
Dim m As String
Dim y As Long
td = Date
d = Day(td)
m = Format(Month(td), "mmm")
y = Year(td)
Sheets("sheet1").Name = _
m & "-" & d & "-" & y

regards
FSt1
 
R

ryguy7272

wow!!!


--
RyGuy


FSt1 said:
hi
you can't name a sheet by a date because you can't use traditions date
seperators in the name.
these characters are forbidden by excel
:, /, \, *,[ ,]
you can name it with someting that looks like a date like'
2-12-2008 or Feb-12-2008
and that can be done with a macro.
Dim td As Date
Dim d As Long
Dim m As String
Dim y As Long
td = Date
d = Day(td)
m = Format(Month(td), "mmm")
y = Year(td)
Sheets("sheet1").Name = _
m & "-" & d & "-" & y

regards
FSt1
Veronica said:
Good morning.

I have been trying to put a macro in place that will rename Sheet 1 tab to
the current date, every day, in many different new workbooks created daily.
I know the function =TODAY() however I can't seem to get that function to
take on the tab itself. I see that you can Insert an Excel Macro on the tab,
but I don't know how to create this either. I can get the Tab to read Macro1
- but then I don't know how to write that Macro.

I appreciate any input!
 
V

Veronica

OK - I will give this a try.
--
Thanks! Veronica.


FSt1 said:
hi
you can't name a sheet by a date because you can't use traditions date
seperators in the name.
these characters are forbidden by excel
:, /, \, *,[ ,]
you can name it with someting that looks like a date like'
2-12-2008 or Feb-12-2008
and that can be done with a macro.
Dim td As Date
Dim d As Long
Dim m As String
Dim y As Long
td = Date
d = Day(td)
m = Format(Month(td), "mmm")
y = Year(td)
Sheets("sheet1").Name = _
m & "-" & d & "-" & y

regards
FSt1
Veronica said:
Good morning.

I have been trying to put a macro in place that will rename Sheet 1 tab to
the current date, every day, in many different new workbooks created daily.
I know the function =TODAY() however I can't seem to get that function to
take on the tab itself. I see that you can Insert an Excel Macro on the tab,
but I don't know how to create this either. I can get the Tab to read Macro1
- but then I don't know how to write that Macro.

I appreciate any input!
 
V

Veronica

This definitely put a date on my Sheet 1. It is giving me January 12, 2008
however. Is there a way to tell the macro to always use a current date?
--
Thanks! Veronica.


FSt1 said:
hi
you can't name a sheet by a date because you can't use traditions date
seperators in the name.
these characters are forbidden by excel
:, /, \, *,[ ,]
you can name it with someting that looks like a date like'
2-12-2008 or Feb-12-2008
and that can be done with a macro.
Dim td As Date
Dim d As Long
Dim m As String
Dim y As Long
td = Date
d = Day(td)
m = Format(Month(td), "mmm")
y = Year(td)
Sheets("sheet1").Name = _
m & "-" & d & "-" & y

regards
FSt1
Veronica said:
Good morning.

I have been trying to put a macro in place that will rename Sheet 1 tab to
the current date, every day, in many different new workbooks created daily.
I know the function =TODAY() however I can't seem to get that function to
take on the tab itself. I see that you can Insert an Excel Macro on the tab,
but I don't know how to create this either. I can get the Tab to read Macro1
- but then I don't know how to write that Macro.

I appreciate any input!
 
H

Herbert Seidenberg

Try
Sub NameShToday()
Dim td As Date
Dim d As Long
Dim e As Long
Dim m As String
Dim y As Long
td = Date
d = Day(td)
e = Month(td)
m = MonthName(e, 1)
y = Year(td)
Sheets("Sheet1").Name = _
m & "-" & d & "-" & y
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top