ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Worksheet naming (https://www.excelbanter.com/excel-discussion-misc-queries/217054-worksheet-naming.html)

Woodstock

Worksheet naming
 
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.

OssieMac

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

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

--
Regards,

OssieMac


"Woodstock" wrote:

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.


Chip Pearson

Worksheet naming
 

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)


On Mon, 19 Jan 2009 14:35:01 -0800, Woodstock
wrote:

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.


Woodstock

Worksheet naming
 
This worked great! Thank you so much!

"Chip Pearson" wrote:


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)


On Mon, 19 Jan 2009 14:35:01 -0800, Woodstock
wrote:

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.




All times are GMT +1. The time now is 01:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com