Bonsoir le Forum
' returns the sum of each cell in the range InputRange that has the same
' background color as the cell in ColorRange
' example: =SumByColor($A$1:$A$20,B1)
' range A1:A20 is the range you want to sum
' range B1 is a cell with the background color you want to sum
Function SumByColor(PlageEntree As Range, CouleurPlage As Range) As Double
Dim Cell As Range, TempSum As Double, ColorIndex As Integer
ColorIndex = CouleurPlage.Cells(1, 1).Interior.ColorIndex
TempSum = 0
On Error Resume Next
For Each Cell In PlageEntree.Cells
If Cell.Formula <> "" Then
If Cell.Interior.ColorIndex = ColorIndex Then TempSum = TempSum + _
Cell.Value
End If
Next Cell
On Error GoTo 0
Set Cell = Nothing
SumByColor = TempSum
End Function
Esperant t'avoir aider