Macro to re-calcluate and count times run

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I'm looking for a basic macro that re-calculates the formula in a
spreadsheet until a certain condition is met (i.e. a solution found, being a
"yes" value in a particular cell) but counts the number of times it takes
before that condition is met, and then stops recalculating and returns the
result plus the number of times that the scenario had to be run before a
solution was found. The expected number of attempts will probably be less
than 20.

Any suggestions?

Thanks in advance

Mike
 
Mike

I'd try something like
Do while
conditions here
count = count +1

code here
loop

msgbox count

End sub
and place this at the start of the loop
 
thanks

mike

Peter Atherton said:
Mike

I'd try something like
Do while
conditions here
count = count +1

code here
loop

msgbox count

End sub
and place this at the start of the loop
 
Back
Top