urbanito1
XLDnaute Occasionnel
bonsoir à la communauté
petite macro de Softmama qui permet d'addionner des montants mensuels par rapport à un mois et un paramètre...
petit problème : lorsqu'il y a plusieurs paramètres sur le même mois le calcul est erroné
Sub gogogo()
Range("Z2:Z" & Range("A2").End(xlDown).Row).FormulaR1C1 = "=RC1&RC2"
Range("AA2:AA" & Range("A2").End(xlDown).Row).FormulaR1C1 = "=SUMPRODUCT((R2C[-1]:R" & Range("A2").End(xlDown).Row & "C[-1]=RC[-1])*R2C10:R" & Range("A2").End(xlDown).Row & "C10)"
Set c = Range("Z2"): Set d = Feuil2.Range("E2")
Do While c <> ""
If IsError(Application.Match(c, Feuil2.Range("E2:E" & Range("A2").End(xlDown).Row), 0)) Then
c.Copy d
Cells(c.Row, 1).Resize(, 2).Copy Feuil2.Cells(d.Row, 1)
d.Offset(, -2) = c.Offset(, 1)
Cells(c.Row, "W").Copy Feuil2.Cells(d.Row, 4)
Set d = d.Offset(1)
End If
Set c = c.Offset(1)
Loop
Feuil1.Range("Z:AA").Clear
Feuil2.Range("E:E").Clear
End Sub
que faut-il modifier?
merci
urbanito1
petite macro de Softmama qui permet d'addionner des montants mensuels par rapport à un mois et un paramètre...
petit problème : lorsqu'il y a plusieurs paramètres sur le même mois le calcul est erroné
Sub gogogo()
Range("Z2:Z" & Range("A2").End(xlDown).Row).FormulaR1C1 = "=RC1&RC2"
Range("AA2:AA" & Range("A2").End(xlDown).Row).FormulaR1C1 = "=SUMPRODUCT((R2C[-1]:R" & Range("A2").End(xlDown).Row & "C[-1]=RC[-1])*R2C10:R" & Range("A2").End(xlDown).Row & "C10)"
Set c = Range("Z2"): Set d = Feuil2.Range("E2")
Do While c <> ""
If IsError(Application.Match(c, Feuil2.Range("E2:E" & Range("A2").End(xlDown).Row), 0)) Then
c.Copy d
Cells(c.Row, 1).Resize(, 2).Copy Feuil2.Cells(d.Row, 1)
d.Offset(, -2) = c.Offset(, 1)
Cells(c.Row, "W").Copy Feuil2.Cells(d.Row, 4)
Set d = d.Offset(1)
End If
Set c = c.Offset(1)
Loop
Feuil1.Range("Z:AA").Clear
Feuil2.Range("E:E").Clear
End Sub
que faut-il modifier?
merci
urbanito1