how do i get a randomize number?
Printable View
how do i get a randomize number?
Rnd Function Example
This example uses the Rnd function to generate a random integer value from 1 to 6.
Dim MyValue
MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.
In this case, Num would contain a value between 0 and 2000.Code:Dim Num as Long
Dim MaxRange as Long
MaxRange = 2000
Num = Int(Rnd(1) * MaxRange)
nb. Use the Randomize statement before using Rnd()