View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GSpline GSpline is offline
external usenet poster
 
Posts: 20
Default Trouble with RANDBETWEEN

Ok, using what you talked about I was able to come up with the following:

MyValue = Int((2 * Rnd) + 1) + 6

This gives me a random range of 7-9. This probably is not a "clean" way to
do this calculation, is there a better way to generate a random number
between 7 & 9 as in my example?

Thanks again.


"Ian" wrote:

From Excel online help

MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.


--
Ian
--
"GSpline" wrote in message
...
How would I go about calculating random numbers using a low and high
number
boundary? I found the RANDBETWEEN function and this is apparently exactly
what I am looking for, but it does not seem to work in VBA. I am very new
to
VBA and any suggestions would be welcome.