Private Sub Workbook_Open()
Dim c As Range
Dim depart As Date
Dim D As Variant
Dim ns As Date
If Sheets("Récap_Mensuelle").Cells(4, 1) <> "" Then Exit Sub
D = "02/07/2010"
D = DateSerial(Year(D), Month(D), 1) 'Date départ au 1er du mois
depart = D - ((D - 2) Mod 7) 'lundi avant d
If Weekday(D, 2) > 5 Then depart = depart + 7 '+1semaine si samedi ou dimanche
Sheets("Récap_Mensuelle").Cells(4, 1) = _
UCase("MOIS DE" & " " & Format(depart, "mmmm") & " " & Format(depart, "yyyy"))
With Sheets("Relevé_Hebdo")
.Unprotect
[COLOR="red"].Range("C1,E1,G1,I1,K1") = ""[/COLOR]
.Cells(1, 1) = UCase("MOIS DE" & " " & Format(depart, "mmmm") & " " & Format(depart, "yyyy"))
For Each c In .Range("C1,E1,G1,I1,K1")
ns = DateSerial(Year(depart + (8 - Weekday(depart)) Mod 7 - 3), 1, 1)
[COLOR="Red"] If Month(depart + 7) > Month(D) And Day(depart + 7) > 4 Then Exit For[/COLOR]
c.Value = "Sem " & ((depart - ns - 3 + (Weekday(ns) + 1) Mod 7)) \ 7 + 1
depart = depart + 7
Next
.Protect
End With
End Sub