I've created a module with the assistance of Google, and it works fantastically. What I would now like to do is perform this function only if the cell value in range H2:H1000 is "Consol LTL" AND the color as shown below. Any ideas?
Formula is:
The Module is:
Formula is:
Excel Formula:
=SumByColor($E$2:$E$1000,T23)
The Module is:
VBA Code:
Function SumByColor(SumRange As Range, SumColor As Range)
Dim SumColorValue As Integer
Dim TotalSum As Long
SumColorValue = SumColor.Interior.ColorIndex
Set rCell = SumRange
For Each rCell In SumRange
If rCell.Interior.ColorIndex = SumColorValue Then
TotalSum = TotalSum + rCell.Value
End If
Next rCell
SumByColor = TotalSum
End Function