Navegando na internet, mais precisamente no Youtube, encontrei o vídeo do camarada jiejen que mostra como fazer passo a passo uma macro que faz exatamente o que a fundação SOMASE do Excel faz, porém com critérios baseados na cor da célula. Sem mais delongas, é só acompanhar o vídeo:
Para quem quiser a macro direto, aí vai:
Function SumColor(Color As Range, Range As Range) AsLongDim Cell As Range
Dim ColorIndexNumber AsIntegerDim ColorSum
'Get the Color Index
ColorIndexNumber = Color.Interior.ColorIndex
'For each cell we highlightedForEach Cell In Range
If Cell.Interior.ColorIndex = ColorIndexNumber Then
ColorSum = WorksheetFunction.Sum(Cell.Value) + ColorSum
EndIfNext Cell
SumColor = ColorSum
EndFunction
Function SumColor(Color As Range, Range As Range) As Long
Dim Cell As Range
Dim ColorIndexNumber As Integer
Dim ColorSum
'Get the Color Index
ColorIndexNumber = Color.Interior.ColorIndex
'For each cell we highlighted
For Each Cell In Range
If Cell.Interior.ColorIndex = ColorIndexNumber Then
ColorSum = WorksheetFunction.Sum(Cell.Value) + ColorSum
End If
Next Cell
SumColor = ColorSum
End Function