View Single Post
 
Old 05-17-2009, 05:40 AM
kgfendi kgfendi is offline Windows Vista Office 2007
Novice
 
Join Date: May 2009
Posts: 7
kgfendi is on a distinguished road
Default

HI,

This is typical type for sorting 5 different numbers. You can change the code to be more than this number (exmaple 2000). Good luck for coding!!

Code:
Sub Sorting()
 
    Dim Used(10) As Boolean
    Dim TheRandom As Integer
    For i1 = 1 To 10
    Used(i1) = False
    Next i1
 
    For i = 1 To 5
        Do
        TheRandom = Int(Rnd(i) * 10)
        Loop Until Not Used(TheRandom)
        Used(TheRandom) = True
 
    ActiveCell.Offset(i, 0) = TheRandom
 
    Next i
End Sub
Please get back again if you could not match this solution to accord your numbers!

Kind Regards

Last edited by Bird_FAT; 05-17-2009 at 08:43 AM. Reason: added code brackets
Reply With Quote