Thread: Odd or Even
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
MIKE215 MIKE215 is offline
external usenet poster
 
Posts: 32
Default Odd or Even

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