'Saca la cantidad de decimales que le digas a una cantidad
Public Function Decimales(ByVal num As Double) As String
Dim txt As String, pos As Integer
txt = num
pos = InStr(1, num, ".", vbTextCompare)
If pos = 0 Then _
pos = InStr(1, num, ",", vbTextCompare)
If pos <> 0 Then
Decimales = Right(txt, Len(txt) - pos)
Else
Decimales = "0"
End If
End Function
'Trunca un número dado
Public Function Truncar(ByVal num As Double, ByVal dig As Integer) As String
Truncar = Int(num) & "." & Left(Decimales(num), dig)
End Function