Is there anyway to make VB generate a random number.
eg.
Integer = Random(0,200)
so it would pick a number between 0 and 200
Printable View
Is there anyway to make VB generate a random number.
eg.
Integer = Random(0,200)
so it would pick a number between 0 and 200
Yes. You can use the Rnd functionVB Code:
MSgbox Rnd * 200
VB Code:
Randomize MsgBox Int(Rnd * 200) + 1
That will display a random whole number between 1 to 200.
The generalized formula is
VB Code:
Int((upperbound - lowerbound + 1) * Rnd + lowerbound)