Function xPlusGros_pmo(Plage As Range, Pourcentage As Double) As Long
Dim Somme#
Dim Reste#
Dim Total#
Dim Maxi#
Dim var
Dim j&
Dim cpt&
Application.Volatile
If Pourcentage > 1 Then Exit Function
var = Plage
For j& = 1 To UBound(var, 2)
Somme# = Somme# + var(1, j&)
Next j&
Reste# = Somme# * Pourcentage
Do Until Total# >= Reste#
Maxi# = Application.WorksheetFunction.Max(var)
Total# = Total# + Maxi#
For j& = 1 To UBound(var, 2)
If var(1, j&) = Maxi# Then var(1, j&) = 0
Next j&
cpt& = cpt& + 1
Loop
xPlusGros_pmo = cpt&
End Function