Hi,
I want the decimals values.
I need both of the values in separated fields.
The value before the "," I know how to get, the value after is the problem.
For example 5,55 I have one field that returns 5 and want another to return 55.
Thank you
Good lesson in floating point arithmitic and things to consider when doing something like this. May not get what you expect without some extra code.
Code:
.
Public Sub Test()
Dim x As Double
x = -123.345
Debug.Print Abs(x) - Int(Abs(x))
End Sub
Public Sub Test2()
Dim x As Double
x = -123.345
Debug.Print CDec(Abs(x)) - CDec(Int(Abs(x)))
End Sub
The first returns
0.344999999999999
The second returns
0.345
Good lesson in floating point arithmitic and things to consider when doing something like this. May not get what you expect without some extra code.
Code:
.
Public Sub Test()
Dim x As Double
x = -123.345
Debug.Print Abs(x) - Int(Abs(x))
End Sub
Public Sub Test2()
Dim x As Double
x = -123.345
Debug.Print CDec(Abs(x)) - CDec(Int(Abs(x)))
End Sub
The first returns
0.344999999999999
The second returns
0.345
Currency defines a fixed-point number with exactly four decimal places. How many decimal places are then displayed is irrelevant and only a matter of display and interpretation. You can therefore use integer calculations immediately.