All,
When using this code the results for summing the cells values will not show up with a decimal point.
Example: If cell A1=1, cell B1=2.25 the total in C1 should be 3.25 but it only sums as 3.
How can I get the code to allow for decimal point values? Is this a formatting issue?
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function
When using this code the results for summing the cells values will not show up with a decimal point.
Example: If cell A1=1, cell B1=2.25 the total in C1 should be 3.25 but it only sums as 3.
How can I get the code to allow for decimal point values? Is this a formatting issue?
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function