View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Creating a worksheet for every weekday

Sub Test2()
Dim dFrom As Date, dTo As Date
Dim d As Date, i as Long

dFrom = CDate("1/Jan/07")
dTo = CDate("31/Dec/07")
dTo = dFrom + 30 ' limit for testing

Workbooks.Add
n = Worksheets.Count - 1

For d = dFrom To dTo
If WeekDay(CDate(d), 2) < 6 Then
n = n + 1
Worksheets.Add(after:=Worksheets(n)).Name = Format(d, "ddd dd mmm")
End If
Next

Worksheets(1).Activate
End Sub

There's probably a way to exclude holidays.

Regards,
Peter T

"hungledink" wrote in message
...

I was wondering if it is possible to create a macro in a workbook where
every sheet is renamed to display the date of every weekday.

I have to create several spreadsheets at the start of the year and to
manually rename each sheet would be time consuming.

Is it possible?


--
hungledink
------------------------------------------------------------------------
hungledink's Profile: http://www.officehelp.in/member.php?userid=5563
View this thread: http://www.officehelp.in/showthread.php?t=1288816

Posted from - http://www.officehelp.in