1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Function NB_JOURS(mois, année)
NB_JOURS = Day(DateSerial(année, mois + 1, 1) - 1)
End Function
Sub testcreation()
creation_calandrier 2015, 45
End Sub
Function creation_calandrier(année, couldim)
pageblanche
For mois = 1 To 12
Cells(1, mois) = UCase(MonthName(mois))
For i = 1 To NB_JOURS(mois, année)
jour = Format(DateSerial(année, mois, i), "dddd")
colonne = Cells.Find(UCase(MonthName(mois))).Column
With Cells(i + 1, colonne)
.Value = Format(DateSerial(année, mois, i), "ddd:") & i
If jour = LCase("dimanche") Then .Interior.ColorIndex = couldim
End With
Next
Next
finition
End Function
Sub pageblanche()
Cells.Clear
With ActiveSheet
Columns("A:L").ColumnWidth = 16
Rows("1:1").RowHeight = 23
Rows("2:32").RowHeight = 19
End With
End Sub
Function finition()
For Each cel In ActiveSheet.UsedRange
cel.BorderAround 2
cel.Font.Size=9
Next
With Range(Cells(1, 1), Cells(1, 12))
.HorizontalAlignment = xlCenter
.Font.Bold = True
.verticalAlignment = xlCenter
.Interior.Color = 15773696
End With
End Function |
Partager