Begins a Solver solution run. Equivalent to clicking Solve in the Solver Parameters dialog box.

Before you use this function, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select the Solver.xlam check box under Available References. If Solver.xlam does not appear under Available References, click Browse and open Solver.xlam in the \office12\library\Solver subfolder.

SolverSolve(UserFinish, ShowRef)UserFinish Optional Variant.Trueto return the results without displaying the Solver Resultsdialog box. Falseor omitted to return the results and display the Solver Resultsdialog box.
ShowRef Optional Variant. Used only if Trueis passed to the StepThruargument of the SolverOptionsfunction. You can pass the name of a macro (as a string) as the ShowRefargument. This macro is then called whenever Solver returns an intermediate solution.

Example

This example uses the Solver functions to maximize gross profit in a business problem. The SolverSolve function begins the Solver solution run.

Worksheets("Sheet1").Activate SolverReset SolverOptions Precision:=0.001 SolverOK SetCell:=Range("TotalProfit"), _ MaxMinVal:=1, _ ByChange:=Range("C4:E6") SolverAdd CellRef:=Range("F4:F6"), _ Relation:=1, _ FormulaText:=100 SolverAdd CellRef:=Range("C4:E6"), _ Relation:=3, _ FormulaText:=0 SolverAdd CellRef:=Range("C4:E6"), _ Relation:=4 SolverSolve UserFinish:=False SolverSave SaveArea:=Range("A33")
Initiate execution of Solver? Solver Solve Function SolverSolve SolverSolve Function Start calculating solution for solver problem?