Bonsoir à tous,
En deux temps
1) tri et filtre les dates (filtre élaboré)
2) formule SommeProd sur les dates filtrées
Private Sub Worksheet_Change(ByVal Target As Range)
'Macros par Claude Dubois pour "paulhino64" Excel-Pratique le 24/04/11
Dim Lg%
If Not Application.Intersect(Target, Range("b7")) Is Nothing Then
Application.ScreenUpdating = False
Lg = Range("d65536").End(xlUp).Row
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Range("a10:b" & [a65536].End(xlUp).Row).ClearContents 'efface
'--- tri ---
Range("d8:g" & Lg).Sort Key1:=Range("e8"), Order1:=xlAscending, Key2:=Range("d8") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
'--- filtre ---
Range("i2") = "=e9<>e10" 'critère
Range("d8:g" & Lg + 1).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Range("i1:i2"), CopyToRange:=Range("a9"), Unique:=False
Range("i2").ClearContents
'--- formules ---
Lg = Range("a65536").End(xlUp).Row
Range("b10:b" & Lg) = "=SUMPRODUCT((Export)*(Dates=a10)*(Commodity=$b$7))"
Application.Goto Range("a1"), Scroll:=True
Target.Activate
End If
End Sub
PS: merci de solder ton poste précédent
Amicalement
Claude