How do you randomly generate numbers in Excel 2007?

  • Thread starter Thread starter Steve Bedard
  • Start date Start date
S

Steve Bedard

How do you randomly generate numbers from 1 to 84 without duplicates in Excel
2007?
 
Hi,

the question isn't clear but try this. Select the cells you want the numbers
in and run this code. Because you are in the range 1 to 84 you mest selevt 84
cells or less

Sub Unique_Rands()
Dim FillRange As Range
Set FillRange = Selection
For Each c In FillRange
Do
c.Value = Int((84 * Rnd) + 1)
Loop Until WorksheetFunction.CountIf(FillRange, c.Value) < 2
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
Well..., I don't know how much of a "gambler" you are - but as a "Gimmick"
you are invited to try the proposal in the picture.
Any cell - in range F1:F84 must be blank.
An "X" points that that value was generated more than once.
Cells A1, B1 and F1 should be copied down all the way until row 84.
http://img717.imageshack.us/img717/5083/nonamesi.png
Micky
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Random Numbers 6
Random Generator 15
How can I sort a column of numbers generated by excel RAND funct? 5
Random Numbers 1
Unique Random Numbers 5
Generate random numbers 3
Random Numbers 4
random numbers 3

Back
Top