SolverOkDialog Function

Excel Developer Reference

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. 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.

SolverOkDialog(SetCell, MaxMinVal, ValueOf, ByChange)

MaxMinVal Specifies
1 Maximize
2 Minimize
3 Match a specific value

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