Pour l'instant je suis arrivé ici mais avec une petite erreur pour mon NbLg
Sub calcul()
Dim Nblg As Long
Nblg = Sheets("Facture").Range("A" & Rows.Count).End(xlUp).Row
With Sheets("AFFRET").Range("H2:H" & Sheets("AFFRET").Range("A" & Rows.Count).End(xlUp).Row)
[barrer].Formula = "=SUMPRODUCT((Facture!$A$2:$A$" & Nblg & "=$A2)*(Facture!$AO$2:$DA$ & Nblg))"[/barrer]
.Value = .Value
End With
End Sub
Voilà qui devrait convenir
Edit : rajout du .clearcontents et screenupdating = False
Sub calcul()
Dim NbLg As Long, NbLg2 As Long
NbLg = Sheets("Facture").Range("A" & Rows.Count).End(xlUp).Row
NbLg2 = Sheets("AFFRET").Range("A" & Rows.Count).End(xlUp).Row
ScreenUpdating = False
With Sheets("AFFRET").Range("H2:H" & NbLg2)
.ClearContents
.Formula = "=SUMPRODUCT((Facture!$A$2:$A$" & NbLg & "=$A2)*(Facture!$AO$2:$DA$" & NbLg & "))"
.Value = .Value
End With
End Sub