Try this:
Code:Public Function EvenOdd(num&) As Boolean Dim a As Long a = (Int(num& / 2)) * 2 If a = num& Then EvenOdd = True 'Even If a <> num& Then EvenOdd = False 'Odd End Function Usage: If EvenOdd(2) Then MsgBox "Even" Else MsgBox "Odd" End If
|
Results 1 to 3 of 3
Thread: Newbie code questionThreaded View
|
Click Here to Expand Forum to Full Width |