Odd or Even
Public Function IsOdd(Val) As Boolean
IsOdd = (Val \ 2) * 2 < Val
End Function
--
HTH
Bob Phillips
"MIKE215" wrote in message
...
Hi PraxisPete
You can use the MOD operator to return the remainder of a division by 2
VAR1 = 13
ANS = VAR1 MOD 2
and test the value of ANS. ANS = 1 and is odd in this case.
Regards,
Mike
"PraxisPete" wrote:
Hi Everybody
I think this should be straight forward but brain is just not working
today
How can I use VBA code to determine if the contents of a varible is odd
or
even?
Many thanks
|