From: The Rook on 25 Mar 2010 09:44 I am wanting to generate random numbers from 1 to 20 in cells A1 to A20, but have no duplicates. How can I do this? From: Jacob Skaria on 25 Mar 2010 09:48 Watch out this http://www.youtube.com/watch?v=SoK9kq-0uXg -- Jacob "The Rook" wrote: > I am wanting to generate random numbers from 1 to 20 in cells A1 to A20, but > have no duplicates. > > How can I do this? From: Bob I on 25 Mar 2010 09:55 place 1 - 20 in column A, in column B put RAND(), select a1:b2, Sort on column B. The Rook wrote: > I am wanting to generate random numbers from 1 to 20 in cells A1 to A20, but > have no duplicates. > > How can I do this? From: Mike H on 25 Mar 2010 10:05 Hi, You can use this macro Sub Liminal() Dim FillRange As Range Set FillRange = Range("A1:A20") For Each c In FillRange Do c.Value = (20 * 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. "The Rook" wrote: > I am wanting to generate random numbers from 1 to 20 in cells A1 to A20, but > have no duplicates. > > How can I do this? From: James Silverton on 25 Mar 2010 10:37 Mike wrote on Thu, 25 Mar 2010 07:05:01 -0700: > You can use this macro > Sub Liminal() > Dim FillRange As Range > Set FillRange = Range("A1:A20") > For Each c In FillRange > Do > c.Value = (20 * 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. Come on Mike, William of Ockham said essentially that a long time ago :-) -- James Silverton Potomac, Maryland Email, with obvious alterations: not.jim.silverton.at.verizon.not  |  Next  |  Last