Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    361
    Thanks
    0
    Thanked 1 Time in 1 Post
    I have the following statement in one of my macros. It works fine. However, it pops up with every moulding that fits the description while I only need it to pop up if the moulding has an odd number of segments. As such I thought it would be handy to add one more AND to the string that checks for an ODD number in a specific cell.

    Is ISODD the right function in this situation? Would I just add something like...........And (ISODD(Range("a1")) = 1..............?

    I could of course experiment but thought I'd ask for a little help first.


    If InStr(LCase(Range("C14")), "half round") = 1 And Range("E25") > 42 And InStr(LCase(Range("C57")), "ship") = 1 Then
    MsgBox ("Top center joint to cut for shipping?")
    End If

    Thanks,
    BH

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    ISODD is a worksheet function, not a VBA function. In VBA you can use

    ... And (Range("A1") Mod 2 = 1) Then

    a Mod b returns the remainder of a after integer division by b. For example, 11 Mod 4 = 3, for 4 goes 2 times into 11, leaving a remainder of 3.
    A number Mod 2 will return 0 if the number is even, and 1 if the number is odd.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    361
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks Hans.............that's pretty slick !!

    BH

Posting Permissions

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