Returning Flags from Solver used in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am running some VBA that uses Solver in a loop for a series of scenarios
related to a particular problem (i.e. up to 500). While the program runs
from start to finish with no problems, I have realised on viewing the results
that in some of the scenarios, Solver was unable to find a feasible solution.
Rather than having to go through each line one by one like this, or to have
to print out 400 Answer Reports, is there a way that Solver can return a flag
e.g. 1 vs 0, TRUE or FALSE, etc to indicate whether each iteration has
terminated with a feasible solution or not?
 
Newton86 -

Try something like this (untested):

Dim SolverResult As Integer
SolverResult = SolverSolve(UserFinish:=True)

Then, if SolverResult is zero or one or two, everything was OK. Four means
it didn't converge. Five means there are no feasible solutions.

- Mike

www.mikemiddleton.com
 
Back
Top