Same as the SolverOK function, but also displays the Solver dialog box.
The Solver add-in is not enabled by default. Before you can use this function, the Solver add-in must be enabled and installed. After the Solver add-in is installed, you must establish a reference to the Solver add-in. For information about how to do that, see Before Using The Solver VBA Functions.
Syntax
SolverOkDialog ( SetCell, MaxMinVal, ValueOf, ByChange, Engine, EngineDesc)
SetCell Optional Variant. Refers to a single cell on the active worksheet. Corresponds to the Set Target Cell box in the Solver Parameters dialog box. MaxMinVal Optional Variant. Corresponds to the Max, Min, and Value options in the Solver Parameters dialog box.
MaxMinVal | Specifies |
---|---|
1 | Maximize |
2 | Minimize |
3 | Match a specific value |
ValueOf Optional Variant. If MaxMinVal is 3, you must specify the value that the target cell is matched to. ByChange Optional Variant. The cell or range of cells that will be changed so that you'll obtain the desired result in the target cell. Corresponds to the By Changing Cells box in the Solver Parameters dialog box. Engine Optional Variant. The Solving method that should be used to solve the problem: 1 for the Simplex LP method, 2 for the GRG Nonlinear method, or 3 for the Evolutionary method. Corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box. ByChange Optional Variant. An alternate way to specify the Solving method that should be used to solve the problem as a string: "Simplex LP", "GRG Nonlinear", or "Evolutionary". Corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box.
Example
This example loads the previously calculated Solver model stored on Sheet1, resets all Solver options, and then displays the Solver Parameters dialog box. From this point on, you can use Solver manually.
Worksheets("Sheet1").Activate
SolverLoad LoadArea:=Range("A33:A38")
SolverReset
SolverOKDialog SetCell:=Range("F7")
SolverSolve UserFinish:=False