I got this code off of somebody on this site. It's supposed to randomly assign numbers to a range. It seems to work, but I don't understand the meaning of most of the code. If anyone feels like explaining how it runs, I'd appreciate it.




Sub randomness()

Dim j, r, rmax
Dim sel(100)
sel(0) = 1
Randomize
rmax = 20 ' maximun number of choices

For i = 1 To rmax

j = 0
While sel(j) > 0
j = Int((rmax * Rnd) + 1)
Wend
sel(j) = 1
Cells(j, 1) = i

Next i

End Sub