1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Lottery

Discussion in 'Business Applications' started by Aegis1, Sep 1, 2004.

Thread Status:
Not open for further replies.
  1. Aegis1

    Aegis1 Thread Starter

    Joined:
    Jan 3, 2004
    Messages:
    24
    Hello folks, have a question a friend asked me.... is there a way in excel 2000 to randomly select numbers 1-52 just like a lottery does?????? Thanks
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Here is an example using a user-defined function. It allows you to select the range of numbers to select from and also lets you select how many random numbers you want returned.

    http://www.ozgrid.com/VBA/RandomNumbers.htm

    Here is a simple condensed version that generates one number at a time. The function takes two arguments (lowest and highest) These numbers represent the first and last number in the selection range.

    Code:
    Public Function RandomNumber(Lowest As Long, Highest As Long)
       Randomize
       RandomNumber = Int(Rnd * (Highest + 1 - Lowest)) + Lowest
    End Function




    Rollin
     
  3. Aegis1

    Aegis1 Thread Starter

    Joined:
    Jan 3, 2004
    Messages:
    24
    Rollin, Thanks for the link it worked out just fine I'll let you know if she wins anything..............
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/269200

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice