Quitar decimales

Libar
18 de Octubre del 2003
Hola, gente desarrolladora, necesito un favor.
Me podrian decir como hago para quitar decimales a uin resultado por ejemplo 13,45567 quiro que quede 13,45
con solo dos decimales.
Nos vemos
Gracias >=>

Susi?
18 de Octubre del 2003
NumeroA=13,45567
NumeroB=Format(NumeroA,"##.##0.00")

Mederos
18 de Octubre del 2003
tal y como escribio baltasar, se debe tener cuidado son la funcion format que devuelve un string, y puede llevar a errores

mejor es int(num*100) / 100

kathia78
18 de Octubre del 2003
Esta funcion te puede ayudar

Private Function ImprimeNumeros(Numero As Currency) As String
Dim strNumero As String
Dim strDec As String
Dim strX As String
Dim strR As String
Dim strP As String
Dim intPos As Integer
Dim intLong As Integer
Dim intCont As Integer
Dim intCantComas As Integer
strNumero = CStr(CCur(Numero))
If InStr(strNumero, ".") > 0 Then
strDec = Right(strNumero, 2)
If InStr(strDec, ".") > 0 Then
strNumero = strNumero & "0"
Else
strNumero = Mid(strNumero, 1, (InStr(strNumero, ".") + 2))
End If
Else
strNumero = strNumero & ".00"
End If
intLong = Len(strNumero) - 3
intCantComas = intLong / 3
strR = Right(strNumero, 3)
strNumero = Mid(strNumero, 1, Len(strNumero) - 3)
If Len(strNumero) > 3 Then
For intCont = 1 To intCantComas
intPos = intCont * 3
If Len(strNumero) > 3 Then
strP = Right(strNumero, 3)
strNumero = Mid(strNumero, 1, IIf(Len(strNumero) - 3 < 0, Len(strNumero), Len(strNumero) - 3))
strX = strNumero & "," & strP
End If
'strX = strX & "," & strP
Next
Else
strX = strNumero
End If
strX = strX & strR
If Mid(strX, 1, 1) = "," Then strX = Mid(strX, 2)
ImprimeNumeros = Format(strX, "@@@@@@@@@@@@@@@@@")
End Function

Hasta Luego

O France
18 de Octubre del 2003
para quitar decimales yo uso lo siguiente:
mTest = 13.45567
mTest1 = format(mTest, "0.00")

esto es si quieres solo dos decimales, pero si quieres tres agragas un cero, o sea "0.000" y asi sucesivamente.
Ciao


Baltasar
18 de Octubre del 2003
La manera más sencilla sería:

nuevovalor = int ( valor*100 )/100

o ( valor*100 ) 100 que es lo mismo.

si usas la función format, es sólo para representar la cifra.

Si lo que quieres es redondear, usa ROUND.

Saludos.