Code:Option Explicit 'rounding a number Function RoundNumber(lNumber, Optional iDecimalPlaces As Integer = 1) RoundNumber = Int(lNumber * (10 ^ iDecimalPlaces) + 0.5) / (10 ^ iDecimalPlaces) End Function '3 represents the number of places you want after the decimal Private Sub Command1_Click() MsgBox RoundNumber(34567.8987, 3) End Sub




Reply With Quote