SOLVER.SOLVE

Macro Sheets Only

Equivalent to choosing the Solver command from the Tools menu and choosing the Solve button in the Solver Parameters dialog box. If successful, returns an integer value indicating the condition that caused Solver to stop as described in "Remarks" later in this topic.

If this function is not available, you must install the Solver add-in macro.

Syntax

SOLVER.SOLVE(user_finish, show_ref)

User_finish is a logical value specifying whether to display the Solver Results dialog box.

Show_ref is a macro to be called in place of the Show Trial Solution dialog box. It is used when you want to regain control whenever Solver finds a new intermediate solution value.

Remarks

If a problem has not been completely defined, SOLVER.SOLVE returns the #N/A error value. Otherwise, the Solver application is started and the problem specifications are passed to it. When the solution process is complete, SOLVER.SOLVE returns an integer value indicating the stopping condition:

Value Stopping condition

0 Solver found a solution. All constraints and optimality conditions are satisfied.

1 Solver has converged to the current solution. All constraints are satisfied.

2 Solver cannot improve the current solution. All constraints are satisfied.

3 Stop chosen when the maximum iteration limit was reached.

4 The Set Cells values do not converge.

5 Solver could not find a feasible solution.

6 Solver stopped at user's request.

7 The conditions for Assume Linear Model are not satisfied.

8 The problem is too large for Solver to solve.

9 Solver encountered an error value in a target or constraint cell.

10 Stop chosen when the maximum time limit was reached.

11 There is not enough memory available to solve the problem.

12 Another Excel instance is using SOLVER.DLL. Try again later.

13 Error in model. Please verify that all cells and constraints are valid.

Related Functions

SOLVER.FINISH Equivalent to choosing OK in the Solver Results dialog box that appears when the solution process is complete

List of Command-Equivalent Functions