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
| For i = 4 To wsstats.Range("B65536").End(xlUp).Row
If Format(wsstats.Range(Cells(i, 2).Address).Value, "hh:mm") = "00:00" Then
test = datejour + 1
Else
heuretest = wsstats.Range(Cells(i, 2).Address).Value
test = datejour & " " & heuretest
End If
compteur = 0
For y = 1 To UBound(horaires)
If horaires(y, 1) <> "" And horaires(y, 2) <> "" And horaires(y, 3) <> "" And horaires(y, 4) <> "" Then
If horaires(y, 5) = "" Or horaires(y, 6) = "" Or horaires(y, 7) = "" Or horaires(y, 8) = "" Then
If (test >= horaires(y, 1) And test <= horaires(y, 3)) Or (test >= horaires(y, 4) And test <= horaires(y, 2)) Then
compteur = compteur + 1
End If
Else
If (test >= horaires(y, 5) And test <= horaires(y, 7)) Or (test >= horaires(y, 8) And test <= horaires(y, 6)) Then
compteur = compteur + 1
End If
End If
End If
wsstats.Cells(i, 3).Value = compteur
Next y
Next i |
Partager