ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   wksht name as current date - m-d-yy (https://www.excelbanter.com/excel-programming/348311-wksht-name-current-date-m-d-yy.html)

craig_100

wksht name as current date - m-d-yy
 

wksht name as current date - m-d-yy
I'd like to add coding to an existing macro that names the current
worksheet, based on the current date, i.e. m-d-yy format. I assume
there's some date (object?) that will need to be set as a variable,
from which I'll need to extract the month-day-year parts of the date,
put them all into a string, and rename the worksheet? Just not familiar
enough yet with which objects, properties, etc. to use to accomplish
this. Can you help? Thanks!


--
craig_100
------------------------------------------------------------------------
craig_100's Profile: http://www.excelforum.com/member.php...o&userid=29187
View this thread: http://www.excelforum.com/showthread...hreadid=494142


Andrew Taylor

wksht name as current date - m-d-yy
 

Craig,

The line

ActiveSheet.Name = Format(Now, "m-d-yy")

should do what you want.

Andrew Taylor

craig_100 wrote:
wksht name as current date - m-d-yy
I'd like to add coding to an existing macro that names the current
worksheet, based on the current date, i.e. m-d-yy format. I assume
there's some date (object?) that will need to be set as a variable,
from which I'll need to extract the month-day-year parts of the date,
put them all into a string, and rename the worksheet? Just not familiar
enough yet with which objects, properties, etc. to use to accomplish
this. Can you help? Thanks!


--
craig_100
------------------------------------------------------------------------
craig_100's Profile: http://www.excelforum.com/member.php...o&userid=29187
View this thread: http://www.excelforum.com/showthread...hreadid=494142



craig_100[_2_]

wksht name as current date - m-d-yy
 

That did exactly what I wanted. Thanks very much!


--
craig_100
------------------------------------------------------------------------
craig_100's Profile: http://www.excelforum.com/member.php...o&userid=29187
View this thread: http://www.excelforum.com/showthread...hreadid=494142



All times are GMT +1. The time now is 07:09 AM.

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