[Please notice that this page is provided just for historical purposes. You might find it an interesting example for conditional compiling. I suggest to use my UDF sbRandInt now, but if you only need positive random integers 1..n UniqRandInt still is the best fit.]
"Few things are harder to put up with than the annoyance of a good example." [Mark Twain]
Sometimes you need to create random integers without repetition.
If you need 20 random integers within range 1 .. 100, select 20 adjacent cells, enter =UniqRandInt(100) as array formula. If you need them in range 100 .. 199, enter =UniqRandInt(100)+99, in general:
=UniqRandInt(Endvalue - Startvalue + 1) + Startvalue - 1
If your random integers may occur up to 6 times, use =UniqRandInt(100,6). Please notice that the constant ALLOW_REPETITION has to be set to True.
If you need this feature in VBA programming environment then use VBUniqRandInt() as shown below.