If Statement - whole number

  • Thread starter Thread starter Stephen Lynch
  • Start date Start date
S

Stephen Lynch

Can I do a statement that returns a whole number no decimals

For example:

If 4/2 = Wholenumber Then
msgbox "Wholenumber"
Else
msgbox "notwhole"
 
Hi Stephen Lynch,

I think that would fit your request:
if (num)-int(num)=0 then '''this is a wholenumber
do something
else
do something else
endif
where num is your number

HTH Paolo
 
If Int(4/2) = 4/2 Then
'Whole Number
Else
'Number with decimal portion
End If

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
It it is division, then you can use
=4\2 which will return 2
=5\2 will return 2

If it is the result of some other cacluation, you can use either the Int or
the Fix function.
 
Back
Top