#1   Report Post  
Posted to microsoft.public.excel.misc
aftamath
 
Posts: n/a
Default Even and Odd

IS there a keyword in Visual Basic that recognizes whether a number is odd or
even.
Could you explain a little more on how to call these functions and an example
of code for them. How to set a reference to the Analysis toolpak for
iseven(), isodd()? Thanks in advance.



  #2   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey
 
Posts: n/a
Default Even and Odd

It's generally more efficient just to use the Mod function:

Const nTest As Long = 42
Dim bIsOdd As Boolean
Dim bIsEven As Boolean
bIsOdd = nTest Mod 2 = 1
bIsEven = nTest Mod 2 = 0
MsgBox "bIsOdd: " & bIsOdd & vbNewLine & "bIsEven: " & bIsEven


In article ,
"aftamath" wrote:

IS there a keyword in Visual Basic that recognizes whether a number is odd or
even.
Could you explain a little more on how to call these functions and an example
of code for them. How to set a reference to the Analysis toolpak for
iseven(), isodd()? Thanks in advance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"