China Naming Network - Almanac query - How to randomly extract 10 non-duplicate values from 1-50 in excel and return them to 10 cells in ascending order?
How to randomly extract 10 non-duplicate values from 1-50 in excel and return them to 10 cells in ascending order?
Compile the macro abc and run it. Macro code:
Subabc ()
For i = 1 to 10.
Cells(i," A") = Int(Rnd() * 50) + 1
If I> then 1
For j = 1 to i-1
If cell (i, "a") = cell (j, "a"), then
i = i - 1
Quit for ...
If ... it will be over.
Next J.
For j = 1 to i-1
If cell (I, "a") <; Cells (j, "a") and then
B = cell (i, "a")
Cell (i, "A") = cell (j," a ")
Cell (j, "a") = b
If ... it will be over.
Next J.
If ... it will be over.
Next, I
End joint