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 43 44 45 46 47 48 49 50 51
| Sub ColorieLesJoursFériés()
Set fj = Sheets("Jours spéciaux")
derlnF = fj.Range("A1").End(xlDown).Row 'F pour férié
derlnA = fj.Range("D1").End(xlDown).Row 'A pour Anniversaire
derlnV = fj.Range("G1").End(xlDown).Row 'V pour vacanses
Application.ScreenUpdating = False
Application.Calculation = xlManual
ReDim dte(12, 5, 7)
For i = 0 To 11
For j = 0 To 4
For k = 0 To 6
Cells(18 * i + 6, 9 * j + k + 3).Interior.Color = RGB(236, 200, 164)
Cells(18 * i + 5, 9 * j + k + 3).Font.Color = RGB(0, 0, 0)
Cells(18 * i + 5, 9 * j + k + 3).ClearComments
Cells(18 * i + 5, 9 * j + k + 3).Borders(xlEdgeBottom).LineStyle = xlNone
Cells(18 * i + 5, 9 * j + k + 3).Borders(xlEdgeTop).LineStyle = xlNone
If Cells(18 * i + 6, 9 * j + k + 3).Value <> "" Then
dte(i, j, k) = Cells(18 * i + 6, 9 * j + k + 3)
For t = 3 To derlnF
If fj.Range("A" & t) = dte(i, j, k) Then
Cells(18 * i + 6, 9 * j + k + 3).Interior.Color = RGB(255, 0, 0)
End If
Next t
For t = 3 To derlnA
If DateSerial(fj.Range("B1"), Month(fj.Range("D" & t)), Day(fj.Range("D" & t))) = dte(i, j, k) Then
Cells(18 * i + 5, 9 * j + k + 3).Font.Color = RGB(255, 0, 0)
Cells(18 * i + 5, 9 * j + k + 3).AddComment
Cells(18 * i + 5, 9 * j + k + 3).Comment.Text Text:=fj.Range("E" & t) & " a " & fj.Range("B1") - Year(fj.Range("D" & t)) & " ans"
End If
Next t
For t = 3 To derlnV
If dte(i, j, k) >= fj.Range("G" & t) And dte(i, j, k) <= fj.Range("H" & t) Then
Cells(18 * i + 5, 9 * j + k + 3).Borders(xlEdgeBottom).LineStyle = xlDouble
Cells(18 * i + 5, 9 * j + k + 3).Borders(xlEdgeTop).LineStyle = xlDouble
Cells(18 * i + 5, 9 * j + k + 3).Borders(xlEdgeBottom).Color = RGB(0, 255, 0)
Cells(18 * i + 5, 9 * j + k + 3).Borders(xlEdgeTop).Color = RGB(0, 255, 0)
Cells(18 * i + 5, 9 * j + k + 3).Select
End If
Next t
End If
Next k
Next j
Next i
Application.Calculation = xlAutomatic
End Sub |
Partager