Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Add new sheets with week ending dates

Is there a way I can add 51 new sheets to a workbook that names those sheets
with a week ending date? Sheet 1 is currently names WE 110604; I would like
an additional 51 sheets with each new week ending date. Sheet 2 would be WE
111304, Sheet 3 would be WE 112004, and so on. I appreciate the help, thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Add new sheets with week ending dates

Hi Cottage6,

Try:

Sub Tester01()
Dim i As Long
Dim dte As Date

dte = CDate("6 Nov 2004")

For i = 1 To 51
dte = dte + 7
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "WE " & Format(dte, "mmddyy")
Next

End Sub

---
Regards,
Norman



"cottage6" wrote in message
...
Is there a way I can add 51 new sheets to a workbook that names those
sheets
with a week ending date? Sheet 1 is currently names WE 110604; I would
like
an additional 51 sheets with each new week ending date. Sheet 2 would be
WE
111304, Sheet 3 would be WE 112004, and so on. I appreciate the help,
thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Add new sheets with week ending dates

Here is one way:
' Creates sheets in reverse order so sheets are in ascending order when
finished

Sub WeekMake()

StartDate = #11/6/2004#
'Calculate last Week
mydays = 51 * 7
'Establish ending week
EndWeek = StartDate + mydays
'Add 1 more week to last week so for loop works
WeekEnding = EndWeek + 7
For s = 1 To 51
Sheets.Add
WeekEnding = WeekEnding - 7
SheetName = "WE " & Month(WeekEnding) & Day(WeekEnding) &
Right(Year(WeekEnding), 2)
ActiveSheet.Name = SheetName
Next s

End Sub
"cottage6" wrote in message
...
Is there a way I can add 51 new sheets to a workbook that names those
sheets
with a week ending date? Sheet 1 is currently names WE 110604; I would
like
an additional 51 sheets with each new week ending date. Sheet 2 would be
WE
111304, Sheet 3 would be WE 112004, and so on. I appreciate the help,
thanks!



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
Convert regular Date to Week Ending or Week Beginning Dates Sam H Excel Discussion (Misc queries) 5 April 3rd 23 04:39 PM
Converting Dates to Week Ending time period drew Excel Worksheet Functions 8 June 24th 08 04:09 PM
Entering week ending dates Jenilise Excel Discussion (Misc queries) 3 September 14th 07 12:04 AM
How to format cells to show dates as the week-ending date of that dereksmom Excel Worksheet Functions 1 July 12th 06 04:40 PM
Week ending [email protected] Excel Worksheet Functions 3 November 1st 05 04:52 PM


All times are GMT +1. The time now is 09:14 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"