Function CalculX(Y, Z)
Dim Y1#, Y2#, Z11#, Z12#, Z21#, Z22#, Z1#, Z2#, X1#, X#
On Error GoTo Fin
' Détermination des somments du trapèze
IndY1 = Application.Match(Y, Range("C:C"), 1)
Y1 = Cells(IndY1, "C"): Y2 = Cells(1 + IndY1, "C") ' Y1,Y2
IndZ1 = Application.Match(Z, Range(IndY1 & ":" & IndY1), 1)
Z11 = Cells(IndY1, IndZ1): Z12 = Cells(IndY1, IndZ1 + 1) ' Z11,Z12
IndZ2 = Application.Match(Z, Range(IndY1 + 1 & ":" & IndY1 + 1), 1)
Z21 = Cells(IndY1 + 1, IndZ2): Z22 = Cells(IndY1 + 1, IndZ2 + 1) ' Z21,Z22
X1 = Cells(13, IndZ1): X2 = Cells(13, IndZ2 + 1) ' X1,X2
' Détermination de Z vs Y1,Y2
Z1 = Z11 * Y / Y1: Z2 = Z21 * Y / Y1:
' Détermination de X
CalculX = Round(X1 * Z / Z1, 0)
Exit Function
Fin:
CalculX = "ERREUR" ' Erreur si Y ou Z pas dans le tableau
End Function