Here's a way to generate unique random numbers from a minimum value to a maximum value
Code:Sub GenerateRandomUnique() Dim lng As Long Const lngMax As Long = 100 Const lngMin As Long = 1 With CreateObject("Scripting.Dictionary") Do While .Count <> lngMax lng = Rnd * (lngMax - lngMin + 1) + 1 .Item(lng) = Empty Loop MsgBox Join(.Keys, " ") End With End Sub
Bookmarks