Bonjour,
A tester et à adapter si besoin.
Option Explicit
Public Sub Ecart_hippique()
Dim ws As Worksheet
Dim derLigne As Integer, cpt As Integer, max As Integer, i As Integer
Application.ScreenUpdating = False
Set ws = Worksheets("Feuil1")
With ws
' colonne B
derLigne = .Range("B" & Rows.Count).End(xlUp).Row
For i = 3 To derLigne
If .Cells(i, 2) = Empty Then
.Cells(i, 2) = 0
.Cells(i, 2).NumberFormat = "[Red]#,##0.00 $"
cpt = cpt + 1
Else
If cpt > max Then max = cpt
cpt = 0
End If
Next
.[K7] = max
cpt = 0: max = 0
' colonne F
derLigne = .Range("F" & Rows.Count).End(xlUp).Row
For i = 3 To derLigne
If .Cells(i, 6) = Empty Then
.Cells(i, 6) = 0
.Cells(i, 6).NumberFormat = "[Red]#,##0.00 $"
cpt = cpt + 1
Else
If cpt > max Then max = cpt
cpt = 0
End If
Next
.[K9] = max
End With
Set ws = Nothing
End Sub