Hi all,
I used below vba code to sum color but it returns #NAME? when i run the code. Could anyone advise me how to fix the error? Attached file for your reference.
>>> use code - tags <<<
And
*Also added on the workbook for any cell changes for below code:*
I used below vba code to sum color but it returns #NAME? when i run the code. Could anyone advise me how to fix the error? Attached file for your reference.
>>> use code - tags <<<
Code:
Option Explicit
Function SumColor(MatchColor As Range) As Double
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
SumColor = SumColor + cell.Value
End If
Next cell
End Function
*Also added on the workbook for any cell changes for below code:*
Code:
Private Sub Workbook_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A:ZZ")) Is Nothing Then
End If
ActiveWorkbook.Calculate
End Sub
Attachments
Last edited by a moderator: