i have code random unique number star from 1 until 15
my code is sukses use dictionary with loop while
but in this moment i want modifikasi with for or for each what must code change
this my code
Sub RandomDictionary()
Dim n&, Max&, Min&
Max = 15: Min = 1
With CreateObject("scripting.dictionary")
Do While .Count <= Max - Min
n = Rnd() * (Max - Min) + Min
.Item(n) = x0
Loop
[a1:a15] = Application.Transpose(.keys)
End With
End Sub
it is sucses but i want to change loop use for or for each what must to do this bellow my code not runing perfect
Sub RandomDictionary()
Dim n&, Max&, Min&,i&
Max = 15: Min = 1
With CreateObject("scripting.dictionary")
for i = 1 to 14
n = Rnd() * (Max - Min) + Min
.Item(n) = x0
next i
[a1:a15] = Application.Transpose(.keys)
End With
End Sub
Bookmarks