Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function SumByColor(rng As Range, clr As String) As Double
- Application.Volatile
- Dim s As Double
- s = 0
- Dim r As Range
- Dim c As Long
- If clr = "red" Then
- c = RGB(256, 0, 0)
- End If
- If clr = "black" Then
- c = RGB(0, 0, 0)
- End If
- For Each r In rng
- If r.Font.Color = c Then
- s = s + r.Value
- End If
- Next r
- SumByColor = s
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement