Searching this forum, I found the below code to generate a list of numbers in random order using vba.
I'm trying to adapt this code in order to add a new variable (x), so that the upperbound value of array V is the value of this variable (x).
How could I rewrite this piece of code?
I'm trying to adapt this code in order to add a new variable (x), so that the upperbound value of array V is the value of this variable (x).
VBA Code:
Sub Demo1()
Dim x, V, L&, R&, S
x = 132
V = [ROW(101:x)]
For L = UBound(V) To 2 Step -1
R = Application.RandBetween(1, L)
S = V(L, 1): V(L, 1) = V(R, 1): V(R, 1) = S
Next
[A1].Resize(UBound(V)).Value2 = V
End Sub
How could I rewrite this piece of code?
VBA Code:
V = [ROW(101:x)]