SolverOkDialog Function
Description
Same as the SolverOk function, but also displays the Solver dialog box.
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 under Available References. If Solver.xla doesn't appear under Available References, click Browse and open Solver.xla in the \Excel\Library\Solver folder.
Syntax
SolverOkDialog(SetCell, MaxMinVal, ValueOf, ByChange)
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 Of 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.
See Also
SolverOk function.
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("TotalProfit")
SolverSolve userFinish:=False