Forum Discussion
wayne gasson
Oct 25, 2018Copper Contributor
VBA Random Number
Hi All, I have created a Random Number Generator using the code below Private Sub CommandButton1_Click() Range("d2") = WorksheetFunction.RandBetween(-2, 2) Range("d3") = WorksheetFunction.R...
- Oct 25, 2018
You may consider the following:
Range("F1") = WorksheetFunction.RandBetween(-2,2) ' The first random number
k = Range("F1")
Range("F2") = WorkhseetFunction.RandBetween (k,2)
' The second random number which lower bound depends on the previous random numberHop it helps.
Man Fai Chan
Iron Contributor
You may consider the following:
Range("F1") = WorksheetFunction.RandBetween(-2,2) ' The first random number
k = Range("F1")
Range("F2") = WorkhseetFunction.RandBetween (k,2)
' The second random number which lower bound depends on the previous random number
Hop it helps.
wayne gasson
Oct 25, 2018Copper Contributor
Thank you I will give it a try :)