Jan Kalop
Active Member
- Joined
- Aug 3, 2012
- Messages
- 389
How to change bellow VBA Code to have random numbers display in vertical cells instead horizontal, as is is written in the bellow VBA Code .
" Sub GetRandomNumbers ()
Dim i As Long, randIndex As Long, Temp As Long, anArray As Variant
Dim MaxNumber As Long, HowManyRands As Long
MaxNumber = Range("es1").Value
HowManyRands = Range("es1").Value
anArray = Evaluate("ROW(1:" & MaxNumber & ")")
Sheets("DRAW").Range("fa13").Value = _
Sheets("DRAW").Range("fa13").Value + 1
Randomize
For i = MaxNumber To 1 Step -1
randIndex = Int(i * Rnd + 1)
Temp = anArray(randIndex)
anArray(randIndex) = anArray(i)
anArray(i) = Temp
Next i
Range("hd1").Resize(, HowManyRands).Value = anArray
End Sub "
" Sub GetRandomNumbers ()
Dim i As Long, randIndex As Long, Temp As Long, anArray As Variant
Dim MaxNumber As Long, HowManyRands As Long
MaxNumber = Range("es1").Value
HowManyRands = Range("es1").Value
anArray = Evaluate("ROW(1:" & MaxNumber & ")")
Sheets("DRAW").Range("fa13").Value = _
Sheets("DRAW").Range("fa13").Value + 1
Randomize
For i = MaxNumber To 1 Step -1
randIndex = Int(i * Rnd + 1)
Temp = anArray(randIndex)
anArray(randIndex) = anArray(i)
anArray(i) = Temp
Next i
Range("hd1").Resize(, HowManyRands).Value = anArray
End Sub "