Make your own free website on Tripod.com

Round Numbers

'Insert this code to your form:

Function Round(nValue As Double, nDigits As Integer) As Double
Round = Int(nValue * (10 ^ nDigits) + 0.5) / (10 ^ nDigits)
End Function

Private Sub Form_Load()
'Replace '19.8455' with the number you want to round, replace '2' with the number of
'digits after the point that the rounded numbr will have.

MsgBox Round(19.8455, 2)
End Sub

Go Back