title: Solver: An unexpected internal error occurred, or available memory was exhausted
body: <p>I'm trying to use the solver from Excel in VBA but I'm having trouble. I keep getting the following error: "Solver: An unexpected internal error occurred, or available memory was exhausted."</p>
  
  <p>Now, I guess solver isn't out of memory as I can solve the same problem when using the solver dialog.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>Sub CoolSolverButton()
  
  SolverReset
  
  SolverOK setCell:=Range("$CK$203"), MaxMinVal:=1, ByChange:=Range("$BH$203:$BQ$222"), Engine:=2, EngineDesc:="Simplex LP"
  
  SolverAdd CellRef:=Range("$BH$203:$BQ$222"), relation:=5, FormulaText:="binary"
  SolverAdd CellRef:=Range("$BH$223:$BQ$223"), relation:=1, FormulaText:=Range("$BH$225:$BQ$225")
  SolverAdd CellRef:=Range("$BH$227:$BH$245"), relation:=1, FormulaText:=Range("$BI$227:$BI$245")
  SolverAdd CellRef:=Range("$BJ$227:$BJ$245"), relation:=1, FormulaText:=Range("$BK$227:$BK$245")
  SolverAdd CellRef:=Range("$BL$227:$BL$245"), relation:=1, FormulaText:=Range("$BM$227:$BM$245")
  SolverAdd CellRef:=Range("$BN$227:$BN$245"), relation:=1, FormulaText:=Range("$BO$227:$BO$245")
  SolverAdd CellRef:=Range("$BP$227:$BP$245"), relation:=1, FormulaText:=Range("$BQ$227:$BQ$245")
  SolverAdd CellRef:=Range("$BR$203:$BR$222"), relation:=2, FormulaText:=Range("$BT$203:$BT$222")
  SolverAdd CellRef:=Range("$BU$203:$BU$222"), relation:=2, FormulaText:=Range("$BW$203:$BW$222")
  
  SolverSolve UserFinish:=True
  
  SolverFinish KeepFinal:=1
  
  End Sub
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>