SolverFinish Function

Description

Tells Microsoft Excel what to do with the results and what kind of report to create when the solution process is completed.

Before you use this function, you must establish a reference to the Solver add-in. With a Visual Basic module active, click References on the Tools menu, and then select the Solver.xla check box in Available References box. If Solver.xla doesn't appear in the Available References box, click Browse, click Solver in the \Excel\Library\Solver folder, and then click OK.

Syntax

SolverFinish(keepFinal, reportArray)

keepFinal

Optional. Can be the number 1 or 2. If keepFinal is 1 or omitted, the final solution values are kept in the changing cells, replacing any former values. If keepFinal is 2, the final solution values are discarded, and the former values are restored.

reportArray

Optional. Specifies what kind of report Microsoft Excel will create when Solver is finished: 1 creates an answer report, 2 creates a sensitivity report, and 3 creates a limit report. Use the Array function to specify the reports you want to display - for example, ReportArray:= Array(1,3).

See Also

SolverFinishDialog Function, SolverOk Function.

Example

This example loads the previously calculated Solver model stored on Sheet1, solves the model again, and then generates an answer report on a new worksheet.


Worksheets("Sheet1").Activate
SolverLoad loadArea:=Range("A33:A38")
SolverSolve userFinish:=True
SolverFinish keepFinal:=1, reportArray:=Array(1)