title: Multiple objectives in Excel solver
body: <p>I have a macro that runs through multiple sets of permutations using Excel's solver. Each macro runs the solver 3 times, using Simplex followed by 2 x Evolutionary. It seems to work reasonably well.</p>
  
  <p>However, I noticed that the solution keeps changing, due to one of the variables only being constrained by a maximum value. As such, I need to make the variable a max/min objective. </p>
  
  <p>I know that Excel's solver only allows for one max/min objective. Is there any way that I can set a second max/min objective?</p>
  
  <p>The code I have is as follows:</p>
  
  <pre><code>a = Range("Q1")
  
      SolverReset
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Simplex LP"
      SolverAdd CellRef:="$O$1", Relation:=1, FormulaText:="80"
      SolverAdd CellRef:="$M$1", Relation:=2, FormulaText:="8"
      SolverAdd CellRef:="$P$1", Relation:=3, FormulaText:="5"
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Simplex LP"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=4, FormulaText:="integer"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=1, FormulaText:="1"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=3, FormulaText:="0"
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Simplex LP"
      SolverSolve ShowRef = 0
  
      SolverReset
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Evolutionary"
      SolverAdd CellRef:="$O$1", Relation:=1, FormulaText:="80"
      SolverAdd CellRef:="$M$1", Relation:=2, FormulaText:="8"
      SolverAdd CellRef:="$P$1", Relation:=3, FormulaText:="5"
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Evolutionary"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=4, FormulaText:="integer"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=1, FormulaText:="1"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=3, FormulaText:="0"
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Evolutionary"
      SolverSolve ShowRef = 0
  
      SolverReset
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Evolutionary"
      SolverAdd CellRef:="$O$1", Relation:=1, FormulaText:="80"
      SolverAdd CellRef:="$M$1", Relation:=2, FormulaText:="8"
      SolverAdd CellRef:="$P$1", Relation:=3, FormulaText:="5"
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Evolutionary"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=4, FormulaText:="integer"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=1, FormulaText:="1"
      SolverAdd CellRef:="$M$2:$M" &amp; a, Relation:=3, FormulaText:="0"
      SolverOk SetCell:="$N$1", MaxMinVal:=1, ValueOf:=0, ByChange:="$M$2:$M" &amp; a, _
          Engine:=3, EngineDesc:="Evolutionary"
      SolverSolve ShowRef = 0
  </code></pre>