>Is using the function Clng will do enough converting a double value into long integer?
Yes. As long as you do not try to convert a number beyond the limitations of an integer (the integer portion)
>Will lngNum contain the rounded-off value?
Yes. But rounded using statistical rounding when the last digit to be rounded is a 5 (1.5 = 2; 2.5 = 2, 3.5 = 4; 4.5 = 4; etc.).
Clng will convert a number to a Long integer. It will round any fraction. Note that the range of a Long is - (2^32) to (2^32) -1, and trying to convert doubles outside this range will result in a trappable error.
You can find this sort of stuff easily if you type Clng in the immediate or code window, put the cursor on it and hit F1. There's more on this in faq222-2244
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Ye! As CCLINT stated, this is statistical rounding!
Do a search on this forum, and forum222 for 'rounding' as the subject has been covered very fully
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.