stop VBA in solver when maximum iterations reached



I would like to add to the VBA code in a way that stops running Solver
after the max iterations has been reached. I would like to do so in a way
that there is no dialogue box for the user.

i.e. I want NO user interaction whatsoever as the solver code is part of a
loop and I want it to move on to the next iteration even if the maximum
iteration was reached.
May 19, 2010
Reaction score
Hi, here is the code. When the iterations (within solver) reach 10000, I want to stop, and keep the results. i.e. a dialog box pops up and asks the user if the want to stop, or continue. I want to automate this step so that the user doesn't have any interaction.

SolverOk SetCell:="$T$9", MaxMinVal:=2, ValueOf:="0", ByChange:="$T$4:$T$7"

SolverOptions MaxTime:=10000, Iterations:=10000, Precision:=0.0000001, _
AssumeLinear:=False, StepThru:=False, Estimates:=1, Derivatives:=1, _
SearchOption:=1, IntTolerance:=0.001, Scaling:=False, Convergence:=0.000000001, _
SolverOk SetCell:="$T$9", MaxMinVal:=2, ValueOf:="0", ByChange:="$T$4:$T$7"

'Results = Application.Run("Solver.xla!SolverSolve", True)

SolverSolve UserFinish:=True

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question