Solver Max Time dialog

  • Thread starter Thread starter Ariel
  • Start date Start date
A

Ariel

I've got a Solver problem set up in an Excel workbook. There is a
macro that runs the Solver. I would like to add to the VBA code a way
to stop running Solver after the max time (set up in the Solver options
prior to running the macro) has been reached. I would like to do so in
a way that there is no dialogue box for the user; I want to create one
macro that runs Solver on several spreadsheets, each of which depends
on the results from the prior sheet. I would like this to be fully
automated.
 
Hi. I don't follow, but see if there are any ideas in this small demo that
may help you. Post back with any questions. HTH :>)

Sub Demo()
'// = = = = = = = = = = = = = = = = = = = = = = = = = = = =
'// Reference: http://www.solver.com/suppstdmsgresult.htm
'// = = = = = = = = = = = = = = = = = = = = = = = = = = = =

' Set up Solver
' ...
' Set up Options
SolverOptions MaxTime:=90 'Max of 90 Seconds!

' Now solve, but remember why Solver stopped
Result = SolverSolve(True)

'// Why did Solver Stop?
Select Case Result
Case 0, 1, 2 'Solution is ok
'Your code...
Case 10
'Stop chosen when the maximum time limit was reached.
'Your code here...
End Select

End Sub
 
HI Dana:
I am happy to see the solution you provided for Ariel. Howver, I am
not able to find the precise statement that I can use to
"automatically" stop the solver (and move to the next iteration step)
INSTEAD of the user having to press the STOP button on the "Show Trial
Solution" Dialog box (when result = 3 , maximum iteration reached)

Can you help? I could not find any funciton in SOLVERADD etc that does
the trick.
Thanks in advance
msuryexcel
 
Back
Top