B
bertrand 19
Guest
Bonjour
J'ai obtenue une fonction qui marche mais dont je ne comprends pas tout...ce qui m'empêche de la remanier pour mon problème
Cette fonction d'un module est la suivante:
-------------------------------------------------
Function PEPS(Sommeventes As Range) As Double
Dim Achat As Range, Prixach As Range, Vente As Range
Dim I As Integer, UnitésàValo As Long
PEPS = 0
Set Achat = Range('Achat')
Set Prixach = Range('Prixach')
Set Vente = Range('Vente')
UnitésàValo = Sommeventes.Value
For I = 3 To Sommeventes.Row
PEPS = PEPS + Prixach(I, 1) * Application.WorksheetFunction.Min(UnitésàValo, Achat(I, 1))
UnitésàValo = Application.WorksheetFunction.Max(UnitésàValo - Achat(I, 1), 0)
Next I
End Function
--------------------------------------------------
Je souhaiterais pouvoir comprendre à quoi correspondent:
'Sommeventes'
'Unitéàvalo'
Je joins le fichier
Merci à vous
J'ai obtenue une fonction qui marche mais dont je ne comprends pas tout...ce qui m'empêche de la remanier pour mon problème
Cette fonction d'un module est la suivante:
-------------------------------------------------
Function PEPS(Sommeventes As Range) As Double
Dim Achat As Range, Prixach As Range, Vente As Range
Dim I As Integer, UnitésàValo As Long
PEPS = 0
Set Achat = Range('Achat')
Set Prixach = Range('Prixach')
Set Vente = Range('Vente')
UnitésàValo = Sommeventes.Value
For I = 3 To Sommeventes.Row
PEPS = PEPS + Prixach(I, 1) * Application.WorksheetFunction.Min(UnitésàValo, Achat(I, 1))
UnitésàValo = Application.WorksheetFunction.Max(UnitésàValo - Achat(I, 1), 0)
Next I
End Function
--------------------------------------------------
Je souhaiterais pouvoir comprendre à quoi correspondent:
'Sommeventes'
'Unitéàvalo'
Je joins le fichier
Merci à vous