Try this:
Sub test()
Dim anyNum As Double
Dim I As Integer
anyNum = 508.51
I = Int(anyNum)
MsgBox I
End Sub
HTH,
Paul
"George Burdell" wrote in message
. ..
How do I return the integer portion of a number? for example 508.5 or
508.49 or 508.51 all should return 508
I have tried this::
Sub test()
Dim anyNum As Double
Dim I As Integer
anyNum = 508.51
I = anyNum \ 1
MsgBox I
End Sub
However, VB is first rounding anyNum in I = anyNum \ 1 and then doing
the \ 1 operation. Thus 508.51 returns 509 instead of the desired value of
508.
Thanks in advance!