One potential method:
Sub test()
Dim unq As Variant, ra As Variant, x As Long
'std number
unq = Application.Unique(Range("A2:A33"))
With Application
ra = .Unique(.RandArray(10000, 1, 1, 99999, True))
For x = 1 To UBound(unq)
Cells.Replace unq(x, 1), ra(x, 1)
Next x
End With
'Student
unq = Application.Unique(Range("B2:B33"))
With Application
ra = .Unique(.RandArray(10000, 1, 1, 99999, True))
For x = 1 To UBound(unq)
Cells.Replace unq(x, 1), "Student" & ra(x, 1)
Next x
End With
'Teacher
unq = Application.Unique(Range("R2:R33"))
With Application
ra = .Unique(.RandArray(10000, 1, 1, 99999, True))
For x = 1 To UBound(unq)
Cells.Replace unq(x, 1), "Teacher" & ra(x, 1)
Next x
End With
End Sub
Bookmarks