+ Reply to Thread
Results 1 to 2 of 2

Even and Odd

Hybrid View

  1. #1
    aftamath
    Guest

    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. #2
    JE McGimpsey
    Guest

    Re: 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 <162893FB-35BB-4CC9-8758-131E75E35D14@microsoft.com>,
    "aftamath" <aftamath@discussions.microsoft.com> 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1