Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Cromag_762003
 
Posts: n/a
Default AutoName Sheets by current date


Hi everyone...

I was wondering what code I need to use to force excel to rename newly
created worksheets as the current date. ie.(today is 25-May-06,
therefore when I create a new sheet, I want it to name the sheet
25-May-06.)

I know it's a bit silly because I can just name them each day....
however I have one of these for each day of the year and 7 different
workbooks all with the same "naming" scheme.

Any help would be greatly appreciated.


--
Cromag_762003
------------------------------------------------------------------------
Cromag_762003's Profile: http://www.excelforum.com/member.php...o&userid=34810
View this thread: http://www.excelforum.com/showthread...hreadid=545664

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
FSt1
 
Posts: n/a
Default AutoName Sheets by current date

hi,
try working something like this in your code.
Sub NameNewSheet()
Dim da As Long
Dim mo As String
Dim yr As Long
da = DatePart("d", Date, dd)
mo = DatePart("m", Date, mm)
yr = DatePart("yyyy", Date, yy)

Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = da & "_" & mo & "_" & yr
End Sub

regards
FSt1

"Cromag_762003" wrote:


Hi everyone...

I was wondering what code I need to use to force excel to rename newly
created worksheets as the current date. ie.(today is 25-May-06,
therefore when I create a new sheet, I want it to name the sheet
25-May-06.)

I know it's a bit silly because I can just name them each day....
however I have one of these for each day of the year and 7 different
workbooks all with the same "naming" scheme.

Any help would be greatly appreciated.


--
Cromag_762003
------------------------------------------------------------------------
Cromag_762003's Profile: http://www.excelforum.com/member.php...o&userid=34810
View this thread: http://www.excelforum.com/showthread...hreadid=545664


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Cromag_762003
 
Posts: n/a
Default AutoName Sheets by current date


Thanks for your response FSt1...

The code you gave me will work.... however it displays in the format of
"dd_mm_yyyy" is there a way to make it display in the format of
"dd_mmm_yy"

Thanks again for your help


--
Cromag_762003
------------------------------------------------------------------------
Cromag_762003's Profile: http://www.excelforum.com/member.php...o&userid=34810
View this thread: http://www.excelforum.com/showthread...hreadid=545664

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default AutoName Sheets by current date

Sub NameNewSheet()
Sheets.Add
Activesheet.name = format(date, "dd_mmm_yy")
End Sub

(But I'd use a 4 digit year--just to avoid confusion/ambiguity.)

Cromag_762003 wrote:

Thanks for your response FSt1...

The code you gave me will work.... however it displays in the format of
"dd_mm_yyyy" is there a way to make it display in the format of
"dd_mmm_yy"

Thanks again for your help

--
Cromag_762003
------------------------------------------------------------------------
Cromag_762003's Profile: http://www.excelforum.com/member.php...o&userid=34810
View this thread: http://www.excelforum.com/showthread...hreadid=545664


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Cromag_762003
 
Posts: n/a
Default AutoName Sheets by current date


Thanks everyone it works great.


--
Cromag_762003
------------------------------------------------------------------------
Cromag_762003's Profile: http://www.excelforum.com/member.php...o&userid=34810
View this thread: http://www.excelforum.com/showthread...hreadid=545664

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Most Current Date Mark Jackson Excel Worksheet Functions 4 May 12th 06 04:18 PM
Formula to subtract a date from current date Fidelio1st Excel Worksheet Functions 3 February 27th 06 03:36 AM
enter a current date in a cell? Tpeyton77 Excel Discussion (Misc queries) 2 June 8th 05 02:30 AM
calculating excel spreadsheet files for pensions and life insurance (including age calculation sheets) RICHARD Excel Worksheet Functions 1 March 15th 05 05:49 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Excel Worksheet Functions 2 February 10th 05 07:18 PM


All times are GMT +1. The time now is 12:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"