G
Guest
The following UDF works great except it rounds to $1,234.00 versus $1,234.56.
How can I get the pennies to show?
Function SumByColor(CellColor As Integer, SumRange As Range) As Long
Dim MyCell As Range
Dim myTotal As Double
For Each MyCell In SumRange
If MyCell.Interior.ColorIndex = CellColor Then
myTotal = WorksheetFunction.Sum(MyCell) + myTotal
End If
Next MyCell
SumByColor = myTotal
End Function
How can I get the pennies to show?
Function SumByColor(CellColor As Integer, SumRange As Range) As Long
Dim MyCell As Range
Dim myTotal As Double
For Each MyCell In SumRange
If MyCell.Interior.ColorIndex = CellColor Then
myTotal = WorksheetFunction.Sum(MyCell) + myTotal
End If
Next MyCell
SumByColor = myTotal
End Function