Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 905
Default Rounding a formula in code

"ordnance1" wrote:
How can I round this out to the 4th digit?
TextBox13.Value = (TimeValue(TextBox12.Value)
- TimeValue(TextBox11.Value)) * 24


TextBox13.Value = Round((TimeValue(TextBox12.Value) _
- TimeValue(TextBox11.Value)) * 24, 4)

or

TextBox13.Value = WorksheetFunction.Round((TimeValue(TextBox12.Value ) _
- TimeValue(TextBox11.Value)) * 24, 4)

The difference is that VBA Round does "banker's rounding". Compare
Round(2.5,0) and WorksheetFunction.Round(2.5,0).

PS: I will try to send email to the address that you used above. If you do
not see my message, please check this thread again for an off-topic
follow-up.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH SunshineinFt.Myers[_2_] Excel Worksheet Functions 7 March 5th 09 06:41 PM
Need help with rounding in VBA code OzonedMan Excel Programming 4 August 21st 07 01:07 AM
I need a formula with rounding up & rounding down to the nearest . Tony Kay Excel Worksheet Functions 3 May 29th 07 11:13 PM
Code not rounding Otto Moehrbach[_6_] Excel Programming 3 July 25th 04 01:47 AM
Rounding questions: (Formula and Code) ? Stuart[_5_] Excel Programming 2 April 8th 04 07:05 PM


All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"