View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How do you randomly generate numbers 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.


"Steve Bedard" wrote:

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