Worksheet naming

W

Woodstock

Can anyone tell me how to create a worksheet with a name that I will choose
later in a macro. Specifically, I would like to create one worksheet each
day and name it with today's date (i.e. '01-19-09'). I am fairly proficient
with writing macros, but have not seen a way to do this yet. Thanks.
 
O

OssieMac

Date is today's date and format function converts the date to text

ActiveSheet.Name = Format(Date, "mm-dd-yyyy")
 
C

Chip Pearson

The following code snippet will create a new worksheet after all the
existing sheets and name it with today's date.


With Worksheets
.Add(after:=.Item(.Count)).Name = Format(Now, "mm-dd-yy")
End With

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
W

Woodstock

This worked great! Thank you so much!

Chip Pearson said:
The following code snippet will create a new worksheet after all the
existing sheets and name it with today's date.


With Worksheets
.Add(after:=.Item(.Count)).Name = Format(Now, "mm-dd-yy")
End With

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Top