Hello everybody
I have this udf function that generates unique random numbers between two numbers
Function UniqueRandBetween(Bottom As Integer, Top As Integer, Amount As Integer) As String
Dim iArr As Variant
Dim I As Integer
Dim R As Integer
Dim Temp As Integer
Application.Volatile
ReDim iArr(Bottom To Top)
For I = Bottom To Top
iArr(I) = I
Next I
For I = Top To Bottom + 1 Step -1
R = Int(Rnd() * (I - Bottom + 1)) + Bottom
Temp = iArr(R)
iArr(R) = iArr(I)
iArr(I) = Temp
Next I
For I = Bottom To Bottom + Amount - 1
UniqueRandBetween = UniqueRandBetween & " " & iArr(I)
Next I
UniqueRandBetween = Trim(UniqueRandBetween)
End Function
I need to get the results of this udf in range of cells say ("A1:A10")
For example : I want to generate random numbers between 1 and 30 .. The number of the results should be 7 numbers
So if I used the udf function
=UniqueRandBetween(1,30,7)
I got results in one cell.. I need to get the results in 7 cells
Bookmarks