I'm trying to create a monte carlo macro in excel using formulas that involve randbetween. See example
Const Sim_Number As Long = 100
Dim outcomes(Sim_Number)
For counter_simple = 1 To Sim_Number
outcomes(counter_simple) = ActiveSheet.Range("A1")
Application.SendKeys ("{F9}") 'refresh
Next counter_simple
After the for loop the macro calculates average, standard deviation etc. The problem I'm having is that it seems like the refreshes happen all at once and the macro itself just uses the value per the last refresh for all 100 instances. So the average, minimum, maximum etc are all just the same value.
I wrote another macro that works as intended with the randbetween functions within the macro itself to determine that the issue is the for loop. What is the issue with refreshing within the macro? Is there a non sendkeys way to refresh randbetween values? Thanks.