Salut Darnel,
tu copie ceci dans un module VBA (ALT F11) / insertion Module:
Function SumByColor(InputRange As Range, ColorRange As Range) As Double
Dim cl As Range, TempSum As Double, ColorIndex As Integer
ColorIndex = ColorRange.Cells(1, 1).Interior.ColorIndex
TempSum = 0
On Error Resume Next ' ignore cells without values
For Each cl In InputRange.Cells
If cl.Interior.ColorIndex = ColorIndex Then TempSum = TempSum + cl.Value
Next cl
On Error GoTo 0
Set cl = Nothing
SumByColor = TempSum
End Function
et tu utilise comme ceci:
=sumbycolor(A1:A10;A1) fera la somme de A1 à A10 pour les cellules qui ont la meme couleur que A1
Patrick
(attention aux coupures de lignes)