tammyl
08-02-2009, 09:21 PM
Hi,
I have this random number function (Rnd) called from my 'Main' worksheet vba code. When I run the Main code, the Rnd script will loop about 30 times. Each loop generates a random number and gets the relevant notation from one worksheet and copies to another worksheet.
Perfect.
Dim Low As Double
Dim High As Double
Application.Volatile
Low = 3 '<<<< CHANGE
High = 130 '<<<< CHANGE
dRand = Round(Rnd * (High - Low) + Low, 0)
My problem is; if I then re-run the Main code for the worksheet, the 30 random numbers generated are exactly the same 30 numbers, in exactly the same order from the previous time i ran the 'Main' code regardless of opening/closing workbook, etc.
How can I ensure that each time I run the 'Main' script the random numbers are 'random' and not the same all the time.
Hope someone can help.
Cheers
tammyl
I have this random number function (Rnd) called from my 'Main' worksheet vba code. When I run the Main code, the Rnd script will loop about 30 times. Each loop generates a random number and gets the relevant notation from one worksheet and copies to another worksheet.
Perfect.
Dim Low As Double
Dim High As Double
Application.Volatile
Low = 3 '<<<< CHANGE
High = 130 '<<<< CHANGE
dRand = Round(Rnd * (High - Low) + Low, 0)
My problem is; if I then re-run the Main code for the worksheet, the 30 random numbers generated are exactly the same 30 numbers, in exactly the same order from the previous time i ran the 'Main' code regardless of opening/closing workbook, etc.
How can I ensure that each time I run the 'Main' script the random numbers are 'random' and not the same all the time.
Hope someone can help.
Cheers
tammyl