Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rename Worksheets to Sequential Dates

I want to create a workbook with 366 worksheets each named for a day o
the year (1-Jan,2-Jan,3-Jan...).

Is there VBA code that will create worksheets and rename them usin
days of the year?

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Rename Worksheets to Sequential Dates

Hi
though not tested I would assume (depending on the data on your
spreadsheets) you won't be able to create 366 separate sheets

--
Regards
Frank Kabel
Frankfurt, Germany

"nchristus " schrieb im
Newsbeitrag ...
I want to create a workbook with 366 worksheets each named for a day

of
the year (1-Jan,2-Jan,3-Jan...).

Is there VBA code that will create worksheets and rename them using
days of the year?

Thanks.


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Rename Worksheets to Sequential Dates

You could do it this way:

Sub CreateSheets()
Dim I As Integer
For I = 1 To 365
Sheets.Add AFTER:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(I, "d-Mmm")
Next
End Sub

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"nchristus " wrote in message
...
I want to create a workbook with 366 worksheets each named for a day of
the year (1-Jan,2-Jan,3-Jan...).

Is there VBA code that will create worksheets and rename them using
days of the year?

Thanks.


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Rename Worksheets to Sequential Dates

This assumes that you have just one sheet in your workbook before you start
and you want it to be the "1-Jan" sheet:

Sub test()

Dim I As Long
Dim sheet_date As Date

Application.ScreenUpdating = False
'On Error GoTo err_handler

sheet_date = #1/1/2004#
ThisWorkbook.Worksheets(1).Name = Day(sheet_date) & "-" &
Format((sheet_date), "mmm")

For I = 1 To 365
sheet_date = sheet_date + 1
ThisWorkbook.Worksheets.Add ,
AFTER:=ThisWorkbook.Worksheets(ThisWorkbook.Worksh eets.Count)
ActiveSheet.Name = Day(sheet_date) & "-" & Format((sheet_date), "mmm")
Next I

err_handler:
Application.ScreenUpdating = True

End Sub

hth,

Doug Glancy

"nchristus " wrote in message
...
I want to create a workbook with 366 worksheets each named for a day of
the year (1-Jan,2-Jan,3-Jan...).

Is there VBA code that will create worksheets and rename them using
days of the year?

Thanks.


---
Message posted from http://www.ExcelForum.com/



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
Sequential dates across worksheets Mick B Excel Discussion (Misc queries) 4 May 22nd 08 05:34 PM
Sequential dates. Afolabi Excel Discussion (Misc queries) 8 June 16th 06 05:48 PM
How do I get non-sequential dates on X-axis Nuke Charts and Charting in Excel 1 June 9th 06 05:09 AM
Sequential dates in different cells slewis3 Excel Worksheet Functions 2 December 24th 04 12:33 AM
Sequential dates in different cells NuHorizon Excel Worksheet Functions 1 December 23rd 04 11:39 PM


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

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"