
Function SommaCC(r As Range) As Long
' Somma le celle che hanno un colore di sfondo
Dim c As Range, cc As Long
For Each c In r
If c.Interior.ColorIndex > 0 Then cc = cc + c.Value
Next
SommaCC = cc
End Function
Function SommaSC(r As Range) As Long
' Somma le celle che non hanno nessun colore
Dim c As Range, sc As Long
For Each c In r
If c.Interior.ColorIndex < 0 Then sc = sc + c.Value
Next
SommaSC = sc
End Function |
