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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
| Range("DN1") = myDate
Dim colonne As Integer
Dim Colonne2 As Integer
Dim tmpDate As Date
Dim dtDate As Date
Dim Fin As Date
Fin = Me.DTPicker21.Value
While Fin < Range("DM5").Value
Range("F5").Select
ActiveCell.Offset(0, 1).Select
colonne = ActiveCell.Column
Colonne2 = (colonne + 1)
dtDate = ActiveCell.Value
Fin = (Fin + 1)
Ligne = 6
ActiveCell.Offset(1, 0).Select
Dim H As Integer, M As Integer, D As Integer
'Les valeurs de H, de M, et de D sont bien trouver par le programme
H = Year(dtDate): M = Month(dtDate): D = Day(dtDate)
If M = 1 And D = 1 Then
fJourFerie = "1er Janvier - Jour de l'An"
Apparament c'est la que ça coince mais c'est compliquer de savoir car pas facile de faire tourner la routine jusqu'à un jour férié
Range(ActiveCell, ActiveCell.End(xlDown)).Select
'là j'utilise du code généré automatiquement, ce doit être pas très beau
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf M = 5 And D = 1 Then
fJourFerie = "1er Mai - Fête du Travail"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf M = 5 And D = 8 Then
fJourFerie = "8 Mai - Victoire 1945"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf M = 7 And D = 14 Then
fJourFerie = "14 Juillet - Fête nationale"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf M = 8 And D = 15 Then
MsgBox "15 Août - Assomption"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf M = 11 And D = 1 Then
fJourFerie = "1er Novembre - Toussaint"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf M = 11 And D = 11 Then
fJourFerie = "11 Novembre - Armistice 1918"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf M = 12 And D = 25 Then
fJourFerie = "25 Décembre - Noël"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
tmpDate = fLundiPaques(H)
If dtDate = tmpDate Then
fJourFerie = "Lundi de Pâques"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf dtDate = tmpDate + 38 Then
fJourFerie = "Ascension"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ElseIf dtDate = tmpDate + 49 Then
fJourFerie = "Lundi de Pentecôte"
Range(ActiveCell, ActiveCell.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
End If
Wend
Exit Sub |
Partager