rnd returns a decmal fraction of a number ie less than 1
so if you want a number in the range 1 to 500 say, multiply the result by 500
this now gives you a number in the range 0.something to 499.something
so now, truncate the number by using a clng, or cint, - now you have a number in the range 0 to 499, so add 1 to the result to get somethig in the range 1 to 500
this is all encapsualted in
myrandomnumber = clng(rnd()*500+1)