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.
|