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
| Private Sub GenMens_Click()
Dim DerLigne As Long, j As Long
Dim DerCol As Integer, i As Integer, k as integer
Dim Flag As Boolean
Dim val As String
Dim mois as variant
mois=array("JANVIER","FEVRIER","MARS","AVRIL","MAI","JUIN","JUILLET","AOUT","SEPTEMBRE","OCTOBRE","NOVEMBRE","DECEMBRE")
for k=0 to 11
With Sheets(mois(k))
DerLigne = .Cells(.Rows.Count, "AH").End(xlUp).Row
DerCol = .Cells(9, .Columns.Count).End(xlToLeft).Column
.Range(.Cells(8, 2), .Cells(DerLigne, DerCol)).Interior.ColorIndex = xlNone
j = 8
Do
For i = 2 To DerCol
If .Cells(j, i).Value <> "" Then
If Not Flag Then
Select Case Weekday(.Cells(j, i).Value, vbMonday)
Case 6: .Range(.Cells(j, i), .Cells(j + 39, i)).Interior.ColorIndex = 27
Case 7: .Range(.Cells(j, i), .Cells(j + 39, i)).Interior.ColorIndex = 35
End Select
Set c = Sheets("BDD").Range("AI37:AI47").Find(CDate(Sheets(mois(k)).Cells(j, i).Value), LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
Set c = Nothing
.Range(.Cells(j, i), .Cells(j + 39, i)).Interior.ColorIndex = 28
End If
End If
End If
Next i
j = j + 2
If Flag Then GoTo suite
Flag = Not Flag
Loop Until j >= DerLigne
End With
suite:
i = 2
Flag = Not Flag
next k
end sub |
Partager