Macros lag

Copper Contributor

Hello! May someone give advice on how to speed up the "calculating thread" of a workbook containing this macro? 

 

Thank you in advance 

 

Function ColorSum(MatchColor As Range, sumRange As Range)

Application.Volatile True
Dim cell As Range
Dim myColor As Long
myColor = MatchColor.Cells(1, 1).Interior.Color
For Each cell In sumRange
If cell.Interior.Color = myColor Then
ColorSum = ColorSum + cell.Value
End If
Next

End Function

0 Replies