excel - VBA : Overflow error -


i have error don't understand why

i have function didn't touch (without error) , it's didn't work... function has on line

i tried function cdbl() , use double type variable

i overflow error

number = 1341.0937961001

nbdecimal = 2

function truncate(number double, nbdecimal integer) double     truncate = int(number * 10 ^ nbdecimal) / (10 ^ nbdecimal) end function 'error here : overflow 

i need help

it overflow when number * 10 ^ nbdecimal exceeds 32767 because thats largest number vba store in integer.

actually wrong: overflow if use cint() rather int()


Comments