Sub Calc()
Dim tablo() As Variant
With ActiveSheet
fin = .Range("A" & .Rows.Count).End(xlUp).Row
tablo = .Range("A2:E" & fin).Value
End With
NbChute = 0
i = LBound(tablo, 1)
While i <= UBound(tablo, 1)
If tablo(i, 4) < 0.6 Then
DebutChute = True
NbChute = NbChute + 1
Else
i = i + 1
End If
If DebutChute Then
j = i
While tablo(j, 4) > tablo(j + 1, 4)
j = j + 1
If j >= UBound(tablo, 1) Then GoTo fin
Wend
DebutChute = False
Debutremontée = True
tablo(i, 5) = tablo(i, 4) - tablo(j, 4)
While tablo(j, 4) < tablo(j + 1, 4)
j = j + 1
If j >= UBound(tablo, 1) Then GoTo fin
Wend
Debutremontée = False
tablo(j, 5) = tablo(j - 1, 4) - tablo(i, 4)
i = j
End If
Wend
fin:
With Sheets("Feuil2")
.Range("A1") = "Il y a: " & NbChute & " Chutes de pression"
.Range("A2").Resize(UBound(tablo, 1), UBound(tablo, 2)) = tablo
End With
End Sub