Skip to main content

SolverFinishDialog Function

Table of contents
  1. Syntax
  2. Example

Tells Microsoft Office Excel what to do with the results and what kind of report to create when the solution process is completed. Equivalent to the SolverFinish function, but also displays the Solver Results dialog box after solving a problem.

Syntax

SolverFinishDialog(KeepFinalReportArrayOutlineReports)

KeepFinal Optional Variant. Can be either 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 Variant. The kind of report that Excel will create when Solver is finished:

  • When the Simplex LP or GRG Nonlinear Solving method is used, 1 creates an Answer report, 2 creates a Sensitivity report, and 3 creates a Limit report.
  • When the Evolutionary Solving method is used, 1 creates an Answer report, and 2 creates a Population report.
  • When SolverSolve returns 5 (Solver could not find a feasible solution), 1 creates a Feasibility Report, and 2 creates a Feasibility-Bounds report.
  • When SolverSolve returns 7 (the linearity conditions are not satisfied), 1 creates a Linearity report.

Use the Array function to specify the reports you want to display, for example, ReportArray:= Array(1,3)OutlineReports Optional Variant. Can be either True or False. If OutlineReports is False or omitted, reports are produced in the "regular" format, without outlining. If OutlineReports is True, reports are produced with outlined groups corresponding to the cell ranges you've entered for decision variables and constraints.

Example

This example loads the previously calculated Solver model stored on Sheet1, solves the model again, and then displays the Finish dialog box with two preset options.

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

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>