View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
wgaskill wgaskill is offline
external usenet poster
 
Posts: 5
Default Catching max iterations Stop of Solver in VBA


This code does not eliminate the Solver dialog box being displayed when max
iterations is reached. Is there anything that can be done to NOT display the
box that says "Max iterations have been reached"?

"Dana DeLouis" wrote:

Hi. Here is a general outline of the code. Good luck...

Sub DEMO()
Dim Results As Long

'...YOUR CODE to set Solver ...

Results = SolverSolve(True)

Select Case Results
Case 0, 1, 2
' Found a solution
' Yeah! Your code to continue...
SolverFinish KeepFinal:=True
Case 3
' Stop chosen when the maximum iteration limit was reached.
' Your code here??
Case 10
' Stop chosen when the maximum time limit was reached.
' Your code here...
Case 7
' The conditions for Assume Linear Model are not satisfied.
' Your code to Un-select this option, and try Solver again...
Case 4
' The Set Target Cell values do not converge.
' Keep count of this error. Perhaps use Random
' Initial values, and try Solver again.
Case Else
' Most likely an Error. :(
' Now what?
End Select

End Sub

HTH :)
--
Dana DeLouis
Win XP & Office 2003


"wgaskill" wrote in message
...
I would like to set up my macro so that if Solver does not converge at
maximum iterations, the Solver dialog is not displayed, and the macro
continues on with the best guess. Is there a way to turn off the dialog
if
Solver doesn't converge?