VBA Sum rounding result??


Posted by Aron on January 17, 2002 9:18 PM

I have rslt Public'd as an integer, and the following two lines of code in two subs in the same module:

Let rslt = WorksheetFunction.Sum(ActiveWindow.Selection)

ActiveCell.Value = Format(rslt, "$#,###.#0")

If the actual sum is 345.67, this sub returns 346.00 - any clues as to what's going on??

Thanks for any help...
Aron

Posted by Virgilia on January 18, 2002 5:02 AM


Try "Dimming" either as Single or as Double.
Integer sets the variable as a whole number only.



Posted by Aron on January 19, 2002 12:15 AM

Perfect!! Thanks!