How I can generate 5000 records in 2 columns of random numbers between 1 and 100 that being unique.
For example:
A B
----------------
1
First run this tiny macro:
Sub dural()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
k = 1
For i = 1 To 100
For j = 1 To 100
Cells(k, 1) = i
Cells(k, 2) = j
Cells(k, 3).Formula = "=rand()"
k = k + 1
Next j
Next i
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = True
End Sub
Then sort cols A,B,C by column C.
Then pick the first 5000 rows.
EDIT#1:
To remove cases in which the value in column A is the same as the value in column B use this macro instead:
Sub dural()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
k = 1
For i = 1 To 100
For j = 1 To 100
If i <> j Then
Cells(k, 1) = i
Cells(k, 2) = j
Cells(k, 3).Formula = "=rand()"
k = k + 1
End If
Next j
Next i
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = True
End Sub