I'm trying to divide a variable x of type Decimal by another Decimal y and get only the integer result, but I'm getting an overflow error.
Dim a As Variant
Dim b As Variant
a = CDec(129801938493)
b = CDec(9385029380)
a = a \ b
Apparently the \ operator coerces its arguments to the Long datatype. Is there a way to do integer division (or modulo division) using Decimal?
a = Int(a / b)
The Int function truncates, so that should work the same as "\".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With