Public Function Redondear( _ ByVal Numero As Currency, _ Optional ByVal Decimales As Long = 0) _ As Currency Dim curParteDecimal As Currency Dim curParteEntera As Currency Dim lngPotencia As Long If Decimales < 0 Then Redondear = Numero Exit Function End If lngPotencia = 10 ^ Decimales curParteEntera = Int(Numero) curParteDecimal = Numero - curParteEntera curParteDecimal = curParteDecimal * lngPotencia If curParteDecimal - Int(curParteDecimal) >= 0.5 Then curParteDecimal = Int(curParteDecimal) + 1 Else curParteDecimal = Int(curParteDecimal) End If Redondear = curParteEntera + curParteDecimal / lngPotencia End Function