View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How do I copy a worksheet for each day of the year?

I may have misread your post.

The macro I supplied adds new sheets and names them.

Do you also want the incremented date entered in a cell on each sheet?

Do you want to copy a specific sheet rather than create new sheets?


Gord

On Thu, 30 Aug 2007 08:07:57 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

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

dFrom = CDate("1/Jan/07") ' edit to suit
dTo = CDate("31/Dec/07") ' edit to suit
dTo = dFrom + 364 ' 365 if above year is a leap year

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


Gord Dibben MS Excel MVP

On Wed, 29 Aug 2007 09:42:03 -0700, Den wrote:

This looks like something I want to do for a daily log i'm making. Can you
tell me how to create the macro?

"Kaybay" wrote:

I'm trying to create a new sheet for each day of the year. It needs to
contain the day and date but I really don't want to copy and paste 2 years of
forms and manually change the date. Please can anybody help.