1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub pluie()
Dim cell_ori As Range
Dim compteur As Double
Dim prev_date As Date
With Worksheets("Feuil6")
Set cell_ori = .Range("A1")
prev_date = cell_ori.Offset(1, 0) - 1
compteur = 0
For I = 1 To .Columns(1).Find("*", , , , , xlPrevious).Row
If cell_ori.Offset(I, 0) = prev_date Then
compteur = compteur + cell_ori.Offset(I, 2)
ElseIf cell_ori.Offset(I, 0) = prev_date + 1 And Hour(cell_ori.Offset(I, 1)) < 6 Then
compteur = compteur + cell_ori.Offset(I, 2)
Else
cell_ori.Offset(I - 1, 3) = compteur
prev_date = cell_ori.Offset(I, 0)
compteur = 0
End If
Next I
End With
End Sub |
Partager