Just for the hell of it I have been playing around with the macro I posted
yesterday. The changes still don't make a silk purse out of the sow's ear
that is the template, but they do take some of the thinking away. If you
change the year at the top of the document to whatever year you wish, and
then put your cursor in the cell that represents the first day of each month
of the year in turn, then run the following, it will determine the month and
calculate the number of days in that month (including leap years). Clears
any existing numbers and background fills then renumbers the month. There
doesn't seem to be much you can do to speed up the fill given the way the
tables in the template have been nested, but at least you can watch the
progress - and it is much quicker than filling by hand!
Dim i As Long
Dim iDays As Long
Dim oRng As Range
Dim oMonth As Range
Dim oYear As Range
Set oYear = ActiveDocument.Tables(1).Cell(1, 1).Range
oYear.End = oYear.End - 1
oYear.Start = oYear.End - 4
Set oMonth = Selection.Tables(1).Cell(1, 1).Range
oMonth.End = oMonth.End - 1
Select Case LCase(oMonth.Text)
Case Is = "april", "june", "september", "november"
iDays = 30
Case Is = "january", "march", "may", "july"
iDays = 31
Case Is = "august", "october", "december"
iDays = 31
Case Is = "february"
If Month(DateSerial(oYear, 2, 29)) = 2 Then
iDays = 29
Else
iDays = 28
End If
End Select
Selection.Bookmarks.Add "StartCell"
For i = 3 To 8
Selection.Tables(1).Rows(i).Range.Select
Selection.Shading.BackgroundPatternColor = wdColorAutomatic
Selection.Delete
Next i
Selection.GoTo What:=wdGoToBookmark, name:="StartCell"
For i = 1 To iDays
Set oRng = Selection.Cells(1).Range
oRng.End = oRng.End - 1
oRng.Text = i
Application.ScreenRefresh
Selection.MoveRight Unit:=wdCell
Next i
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>