F
Frank Kabel
Hi Jim
you have defined the return value as 'Long' and therefore
excel has rounded the result. Try:
Function SumByColor(CellColor As Integer, SumRange As
Range)
Dim mycell As Range
Dim myTotal
For Each mycell In SumRange
If mycell.Interior.ColorIndex = CellColor Then
if isnumeric(mycell.value)
myTotal = mycell.value + myTotal
end if
End If
Next mycell
SumByColor = myTotal
End Function
example 123.11 + 125.11 = $248.00
you have defined the return value as 'Long' and therefore
excel has rounded the result. Try:
Function SumByColor(CellColor As Integer, SumRange As
Range)
Dim mycell As Range
Dim myTotal
For Each mycell In SumRange
If mycell.Interior.ColorIndex = CellColor Then
if isnumeric(mycell.value)
myTotal = mycell.value + myTotal
end if
End If
Next mycell
SumByColor = myTotal
End Function
my sum in whole dollars not with dollars and cents.-----Original Message-----
The below function is working great, only it is producing
example 123.11 + 125.11 = $248.00