ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   random number generation: loop (https://www.excelbanter.com/excel-programming/288871-random-number-generation-loop.html)

NickC[_2_]

random number generation: loop
 
Hello,

I am trying to do a simulation.
I have many random numbers (rand()) within my spreadsheet.

Right now, I keep hitting F9 until I get a certain set of numbers tha
meets some conditions I have.

I would like to know how to program a loop that essentially recalcs th
spreadsheet (just like hitting F9 over and over again) until a certai
cell value is less than a certain numerical value.

Additionally, I want many sets of random numbers that fit this criteri
(otherwise, I could hit F9 until I get one set and then just quit). S
I need something I can "run" repeatedly.

Any help would be vastly appreciated

--
Message posted from http://www.ExcelForum.com


A.W.J. Ales

random number generation: loop
 
Nick,

Suppose the randomly filled cell = A1 , this routine will run until the
value of this cell < the value you specify ( fill in for ???)

Mind however that this routine might end up in an endless loop if you don't
choose your conditionvalue carefull !!!

Sub RunTillCondition()
ConditionValue = ???
While Cells(1, 1) = ConditionValue
Calculate
Wend
End Sub

--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *

"NickC " wrote in message
...
Hello,

I am trying to do a simulation.
I have many random numbers (rand()) within my spreadsheet.

Right now, I keep hitting F9 until I get a certain set of numbers that
meets some conditions I have.

I would like to know how to program a loop that essentially recalcs the
spreadsheet (just like hitting F9 over and over again) until a certain
cell value is less than a certain numerical value.

Additionally, I want many sets of random numbers that fit this criteria
(otherwise, I could hit F9 until I get one set and then just quit). So
I need something I can "run" repeatedly.

Any help would be vastly appreciated !


---
Message posted from http://www.ExcelForum.com/




NickC[_3_]

random number generation: loop
 
It works perfectly !

Thanks, Auk Ales.


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 08:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com