Returning Flags from Solver used in VBA

N

Newton86

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?
 
M

Michael R Middleton

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
 

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

Top