Is this number a multiple of 20?

Hello. I know this sounds stupid but what is the function for discrening whether a variable is a multiple of 20?

I.e. how can I get a boolean response for this question?

for example:

Function CheckMultiple(WhichNumber as long) as boolean

      if IsThisAMultipleFunction(WhichNumber, 20) Then

            CheckMultiple = True


            CheckMultiple = False

     End If

End Function

Thanks all!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Hi butterhook,

Function CheckMultiple(ByVal Which As Long, Optional ByVal OfWhat As Long = 20) As Boolean
    CheckMultiple = (Which Mod OfWhat) = 0
End Function

You can call this either with a single parameter or two if you want to change the divisor.

Tim Cottee
Guy Hengel [angelIII / a3]Billing EngineerCommented:
IsThisAMultipleFunction = (WhichNumber % 20 = 0)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Éric MoreauSenior .Net ConsultantCommented:
       use the modulo operator:        
if WhichNumber mod 20 = 0 then  
            CheckMultiple = True
            CheckMultiple = False
     End If      
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

angelIII's answer is 100% correct.  It makes use of the Modulus operator, which returns the REMAINDER when the number on the Left is Divided By the number on the Right

12 % 10 = 2  (12 divided by 10 leaves a remainder of 2)

23 % 3 = 2 (23 divided by 3 = 7 with a remainder of 2)

butterhookAuthor Commented:
Thanks guys, you are all so incredibly fast off the mark. Sorry I couldn't split the points but I couldn't work out how to divide them! Maybe that will be another question at some point
Guy Hengel [angelIII / a3]Billing EngineerCommented:
50 points cannot be divided, as you need to give at least 30 points per comment.
In case you fulfill that, you can see a 'split points' link below the last comment (before the q is closed)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.