Add a Button and a label to test the code for yourself. This
code generates 25 numbers 1-25 and stores then in the variable "num". The Constant SIZE can be changed if you need to generate more numbers.
Option Explicit
Const SIZE = 25
Dim num(SIZE) As Integer
Private Sub Command1_Click()
Dim i, j As Integer
Dim duplicate As Integer
Dim MyValue
For i = 0 To SIZE - 1
duplicate = 0
Randomize ' Initialize random-number generator.
' Generate random value between 1 and 25.
MyValue = Int(((SIZE) * Rnd) + 1)
num(i) = MyValue
For j = 0 To i - 1
If num(i) = num(j) Then
duplicate = 1
End If
Next
If (duplicate = 1) Then
i = i - 1
End If
Next
Dim MyString As String
MyString = ""
For j = 0 To SIZE - 1
MyString = MyString & "," & num(j)
Next
Label1 = MyString
End Sub