Lottery

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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
 
Joined
Sep 4, 2003
Messages
4,916
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
 

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..............
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Staff online

Members online

Top