Skip to main content

SolverReset Function

Table of contents
  1. Syntax
  2. Example

Resets all cell selections and constraints in the Solver Parameters dialog box and restores all the settings in the Solver Options dialog box to their defaults. Equivalent to clicking Reset All in the Solver Parameters dialog box. The SolverReset function is called automatically when you call the SolverLoad function, if the Merge argument is False or omitted.

Syntax

SolverReset( )

Example

This example resets the Solver settings to their defaults before defining a new problem.

Sub SolverDemo()
    Worksheets("Sheet1").Activate
    Range("F4").Formula = "=SUM(C4:E4)"
    Range("F5").Formula = "=SUM(C5:E5)"
    Range("F6").Formula = "=SUM(C6:E6)"
    Range("F7").Formula = "=SUM(F4:F6)"
    SolverReset
    SolverOptions Precision:=0.001
    SolverOK SetCell:=Range("F7"), MaxMinVal:=3, ValueOf:=50, ByChange:=Range("C4:E6")
    SolverAdd CellRef:=Range("F4:F6"), Relation:=1, FormulaText:=100
    SolverAdd CellRef:=Range("C4:E6"), Relation:=3, FormulaText:=0
    SolverAdd CellRef:=Range("C4:E6"), Relation:=4
    SolverSolve UserFinish:=False
    SolverSave SaveArea:=Range("A33")
End Sub

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>