Alex Piotto
Board Regular
 Joined
 Jul 5, 2016
 Messages
 82
 Office Version

 2007
 Platform

 Windows
' Morning everyone...
I am making a sum of numbers (negatives in that case) from a column.
The numbers are formatted. Like 1,250.55...
I show the result in a textbox. The result is formatted too. Like 1,250.55...
But the decimals are always zero zero. There is a rounding up playing here without asking....
How to avoid it?
I am making a sum of numbers (negatives in that case) from a column.
The numbers are formatted. Like 1,250.55...
I show the result in a textbox. The result is formatted too. Like 1,250.55...
VBA Code:
'SUM NEGATIVES AND PUT RESULT IN TEXTBOX4
Dim x As Long
Dim c As Range
Dim tot As Integer
x = Cells(Rows.Count, "B").End(xlUp).Row
tot = 0
For Each c In Range("H14:H" & x)
If c.Value < 0 Then
tot = tot + c.Value
End If
Next c
ActiveSheet.TextBox4.Value = tot
ActiveSheet.TextBox4.Value = Format(TextBox4.Value, "#,##0.00")
But the decimals are always zero zero. There is a rounding up playing here without asking....
How to avoid it?