View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Fill with random numbers

Hi Dave: Try this. It uses columns I & J as "helper" columns:

Sub luxation()
For i = 1 To 1600
Cells(i, "I").Value = i
Cells(i, "J") = Evaluate("=rand()")
Next
Columns("I:J").Sort Key1:=Range("J1"), Order1:=xlAscending, Header:=xlNo
k = 1
For i = 1 To 200
For j = 1 To 8
Cells(i, j).Value = Cells(k, "I").Value
k = k + 1
Next
Next
Columns("I:J").Clear
End Sub

--
Gary''s Student - gsnu200838


"Dave" wrote:

Hi,

The range A1 - H200 is 1600 cells and I need to fill those cells randomely
with the numbers 1 to 1600, no number must repeat. I played with simply
putting those numbers in the cells and used RAND() in a helper column but
this doesn't really give the randomness I require. Any help please.

D