Dear all,
I have come across this macro but the result that is giving is a number without decimals, even if the values of the cells have more decimals like 13,26 for example.
Do you know how and where should i write that i want the result with more decimals, for example instead of 100 to be 100,2435 ??
Thank you for your help!!
I have come across this macro but the result that is giving is a number without decimals, even if the values of the cells have more decimals like 13,26 for example.
Do you know how and where should i write that i want the result with more decimals, for example instead of 100 to be 100,2435 ??
Thank you for your help!!
Code:
Sub SumColorCount()
Dim Blue5 As Integer, _
Red3 As Integer, _
Yellow6 As Integer
Dim Data As Range
Dim Cell As Range
Set Data = Range("A1:A1000")
For Each Cell In Range("Data")
If Cell.Interior.ColorIndex = 5 Then
Blue5 = Blue5 + Cell.Value
ElseIf Cell.Interior.ColorIndex = 3 Then
Red3 = Red3 + Cell.Value
ElseIf Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + Cell.Value
End If
Next
Range("F10").Value = "Blue = " & Blue5
Range("F11").Value = "Red = " & Red3
Range("F12").Value = "Yellow = " & Yellow6
MsgBox " You have: " & vbCr _
& vbCr & " Blue " & Blue5 _
& vbCr & " Red " & Red3 _
& vbCr & " Yellow " & Yellow6, _
vbOKOnly, "CountColor"
Range("F10:F12").Value = ""
</pre>
Last edited: