Lord_WayneY
0
Q:

vba rnd function

'VBA has the Rnd() function which returns a random single floating point value
'between 0 and 1, but not including 1.

MsgBox Rnd		'<--displays something like 0.74323

'To generate values between two integer numbers, use the following formula:
'Int((max - min + 1) * Rnd + min)

'For example, to generate random integers between 11 and 14:
MsgBox Int((14 - 11 + 1) * Rnd + 11)    '<-- displays 11 or 12 or 13 or 14	

6
'VBA has the Rnd() function which returns a random single floating point value
'between 0 and 1, but not including 1.

MsgBox Rnd		'<--displays something like 0.74323

'To generate values between two integer numbers, use the following formula:
'Int((max - min + 1) * Rnd + min)

'For example, to generate random integers between 11 and 14:
MsgBox Int((14 - 11 + 1) * Rnd + 11)    '<-- displays 11 or 12 or 13 or 14	
4

New to Communities?

Join the community