Sub cal()
Set F = Worksheets("Feuil1")
Set G = Worksheets("Feuil2")
debut = F.Cells(2, 2)
fin = F.Cells(3, 2)
G.Cells(4, 3) = Day(debut)
G.Cells(4, 3).ColumnWidth = 3.5
G.Cells(2, 3) = MonthName(Month(debut))
For i = 1 To (fin - debut)
'affectation des jours du mois
G.Cells(4, i + 3) = Day(debut + i)
G.Cells(4, i + 3).ColumnWidth = 3.5
'Affectation des jours de la semaine
jours = Weekday(debut + i, vbMonday)
If jours = 1 Then
G.Cells(3, i + 3) = "L"
ElseIf jours = 2 Then
G.Cells(3, i + 3) = "Ma"
ElseIf jours = 3 Then
G.Cells(3, i + 3) = "Me"
ElseIf jours = 4 Then
G.Cells(3, i + 3) = "J"
ElseIf jours = 5 Then
G.Cells(3, i + 3) = "V"
ElseIf jours = 6 Then
G.Cells(3, i + 3) = "S"
ElseIf jours = 7 Then
G.Cells(3, i + 3) = "D"
End If
If MonthName(Month(debut + i)) <> MonthName(Month(debut + i - 1)) Then G.Cells(2, i + 3) = MonthName(Month(debut + i)) _
Else: With G.Cells(2, i + 2).Resize(, 2): .Merge: .HorizontalAlignment = xlCenter: End With
Next i
End Sub