Public Function RENGEGORETOPLA(rngCriteria As Range, rngTable As Range, Optional bytType As Byte) As Double
Dim rngLoop As Range
If bytType = 0 Or bytType > 2 Then
bytType = 1
End If
If rngCriteria.Cells.Count <> 1 Or rngCriteria Is Nothing Then
RENGEGORETOPLA = 0
Exit Function
End If
For Each rngLoop In rngTable
If IsNumeric(rngLoop.Value) Then
If bytType = 1 Then
If rngCriteria.Interior.Color = rngLoop.Interior.Color Then
RENGEGORETOPLA = RENGEGORETOPLA + rngLoop.Value
End If
ElseIf bytType = 2 Then
If rngLoop.Font.Bold = True Then
RENGEGORETOPLA = RENGEGORETOPLA + rngLoop.Value
End If
End If
End If
Next rngLoop
End Function