Salut Phil,
Salut Eriiic,
c'est clairement le domaine de formules, je n'en disconviens pas.
Je ne sais pas si j'ai totalement raison mais les calculs en [F2] et [H2] ne devraient-ils pas être annulés si il n'y a pas la donnée de base en [C2] ?
Public Sub Calcul(ByVal iIdx%)
'
Dim tTab, iMax%
'
tTab = Range("A1").Resize(Range("A" & Rows.Count).End(xlUp).Row, 2).Value
'
Union([D2], [F2], [H2]) = ""
For x = 1 To 3
If Choose(x, [C2], [E2], [G2]) <> "" And IsNumeric(Choose(x, [C2], [E2], [G2])) Then
If x = 1 Or (x > 1 And [D2] > 0) Then
iMax = WorksheetFunction.Max(2, [D2])
For y = iMax To UBound(tTab, 1)
If x = 2 Then
If CDbl(tTab(y, 2)) < CDbl([E2]) Then _
[F2] = y: _
Exit For
Else
If CDbl(tTab(y, Choose(x, 1, 2, 1))) >= CDbl(IIf(x = 1, [C2], [G2])) Then _
IIf(x = 1, [D2], [H2]) = y: _
Exit For
End If
Next
End If
End If
Next
'
End Sub
A+