0% found this document useful (0 votes)
31 views1 page

Sum Cells by Fill Color in Excel

This VBA function takes in two range parameters and sums the values of cells in the second range that have the same interior color as specified in the first range. It loops through each cell in the second range, checks if its interior color matches the first range's color, and if so, adds the cell's value to a running total variable. The final running total is returned by the function.

Uploaded by

etfche
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Sum Cells by Fill Color in Excel

This VBA function takes in two range parameters and sums the values of cells in the second range that have the same interior color as specified in the first range. It loops through each cell in the second range, checks if its interior color matches the first range's color, and if so, adds the cell's value to a running total variable. The final running total is returned by the function.

Uploaded by

etfche
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

Function SumColor(rColor As Range, rSumRange As Range)

''''''''''''''''''''''''''''''''''''''

'Written by Ozgrid Business Applications

'[Link]

'Sums cells based on a specified fill color.

'''''''''''''''''''''''''''''''''''''''

Dim rCell As Range

Dim iCol As Integer

Dim vResult

iCol = [Link]

For Each rCell In rSumRange

If [Link] = iCol Then

vResult = [Link](rCell) + vResult

End If

Next rCell

SumColor = vResult

End Function

You might also like