View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jerry W. Lewis
 
Posts: n/a
Default Setting the number of decimal places for a text box.

Excel 2000 and later has a VBA Round function. It does ASTM rounding (rounds
to nearest rounded value, with ties [exactly 5] rounding up or down to make
an even number).

In earlier versions (or to always round 5 up) you can call the worksheet
Round function from VBA by either
Application.Round()
or
WorksheetFunction.Round()
The former former will work in all versions of Excel that support VBA. I
believe that the latter was introduced in Excel 97, but has the advantage of
prompting you with possible worksheet functions that can be called in this
way.

Jerry

"Aaron1978" wrote:


Thanks for your reply, but the calculation is done in VBA not in the
cell that the data is read from. Is there a way of rounding numbers in
VBA, I tried but can't seem to find a way.

Best Regards,

Aaron


--
Aaron1978
------------------------------------------------------------------------
Aaron1978's Profile: http://www.excelforum.com/member.php...o&userid=31201
View this thread: http://www.excelforum.com/showthread...hreadid=519786