Deletes an existing constraint. Equivalent to clicking Solver in the Data | Analyze group and then clicking Delete in the Solver Parameters 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.
SolverDelete( CellRef, Relation, FormulaText)
CellRef Required Variant. A reference to a cell or a range of cells that forms the left side of a constraint. Relation Required Integer. The arithmetic relationship between the left and right sides of the constraint. If you choose 4, 5, or 6, CellRef must refer to decision variable cells, and FormulaText should not be specified.
|4||Cells referenced by CellRef must have final values that are integers.|
|5||Cells referenced by CellRef must have final values of either 0 (zero) or 1.|
|6||Cells referenced by CellRef must have final values that are all different and integers.|
FormulaText Optional Variant. The right side of the constraint.
This example loads the previously calculated Solver model stored on Sheet1, deletes one of the constraints, and then solves the model again.
Worksheets("Sheet1").Activate SolverLoad loadArea:=Range("A33:A38") SolverDelete cellRef:=Range("C4:E6"), relation:=4 SolverSolve userFinish:=False