Results 1 to 5 of 5

Thread: Division with no remainder

  1. #1
    Guest

    Question

    What is the correct syntax for VB? I am trying to find if a number is > 1000 and is also equally divisable by 1000. So far I have...

    ...
    Dim iAmount as Single

    If iAmount > 1000 Then
    MsgBox "Greater than 1000"
    End If

    ...

    Thank You

  2. #2
    Guest
    Try this:
    Code:
    Dim iAmount As Single 
    If (iAmount > 1000) And (iAmount Mod 1000 = 0) Then 
        MsgBox "Greater than 1000 and can be divided by 1000 without a remainder." 
    End If
    Good luck!

  3. #3
    Guest
    Thank You

  4. #4
    Guest
    Try:

    code:
    select case amount/1000
    case is =1
    stuff for equal
    case is >1
    stuff for amount > 1000
    case is =0
    stuff for amount = 0
    case is < 1
    stuff for amount < 0
    end select


    If you wish to treat -1000 as = 1000 then use
    abs(amount/1000)


    Good Luck
    DerFarm

  5. #5

Posting Permissions

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



Click Here to Expand Forum to Full Width