Coolmo
2005-01-28, 07:13 PM
Does anyone have a quick routine or method for rounding numbers in VBA? All my answers keep coming back with 10 decimal places (9.9999999999) instead of just 10.0
Man I miss the RTOS function in Lisp!
Jeff_M
2005-01-30, 06:28 PM
Man I miss the RTOS function in Lisp!
This should help you... :)
Sub test()
Dim precOne As String
Dim precTwo As String
Dim precThree As String
Dim precEight As String
Dim numTest As Double
precOne = "0.0"
precTwo = "0.00"
precThree = "0.000"
precEight = "0.00000000"
numTest = 1.234567890389
Debug.Print Format(numTest, precOne)
Debug.Print Format(numTest, precTwo)
Debug.Print Format(numTest, precThree)
Debug.Print Format(numTest, precEight)
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.