ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Even and Odd (https://www.excelbanter.com/excel-discussion-misc-queries/63941-even-odd.html)

aftamath

Even and Odd
 
IS there a keyword in Visual Basic that recognizes whether a number is odd or
even.

Niek Otten

Even and Odd
 
If you have Analysis Toolpak loaded and set a reference to it in VBA, then
ISODD() and ISEVEN() are available

--
Kind regards,

Niek Otten

"aftamath" wrote in message
...
IS there a keyword in Visual Basic that recognizes whether a number is odd
or
even.




Bernard Liengme

Even and Odd
 
You could 'roll your own'

Function test(num) As Boolean
test = (num Mod 2 = 0)
End Function

--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"aftamath" wrote in message
...
IS there a keyword in Visual Basic that recognizes whether a number is odd
or
even.




aftamath

Even and Odd
 
Could you explain a little more on how to call these functions and an exampl
of code for them. How t oset a reference? Thanks in advance.

"Niek Otten" wrote:

If you have Analysis Toolpak loaded and set a reference to it in VBA, then
ISODD() and ISEVEN() are available

--
Kind regards,

Niek Otten

"aftamath" wrote in message
...
IS there a keyword in Visual Basic that recognizes whether a number is odd
or
even.






All times are GMT +1. The time now is 05:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com