View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
George Burdell George Burdell is offline
external usenet poster
 
Posts: 7
Default Returning just the integer portion of a number

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!