title: VBA Loop in Excel with Solver
body: <p>So here is my issue.  I am trying to write a loop that performs a function using solver.  Basically it starts in one cell, runs solver, moves the target and constraint cells to the right one, solves, moves target and contraint cells to the right 14, solves, right one,  solves, right 14 solves, until it finds a blank.</p>
  
  <p>Here is the first few lines of code to show you what I am doing in the long version.</p>
  
  <pre><code>Range("RI6").Select
      SolverOk SetCell:="$RI$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$RG$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$RI$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$RI$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("RJ16").Select
      SolverOk SetCell:="$RJ$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$RJ$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$RJ$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$RJ$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("RX16").Select
      SolverOk SetCell:="$RX$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$RX$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$RX$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$RX$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("RY16").Select
      SolverOk SetCell:="$RY$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$RY$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$RY$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$RY$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("SM16").Select
      SolverOk SetCell:="$SM$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$SM$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$SM$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$SM$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("SN16").Select
      SolverOk SetCell:="$SN$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$SN$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$SN$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$SN$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("TB16").Select
      SolverOk SetCell:="$TB$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$TB$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$TB$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$TB$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("TC16").Select
      SolverOk SetCell:="$TC$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$TC$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$TC$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$TC$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("TQ16").Select
      SolverOk SetCell:="$TQ$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$TQ$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$TQ$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$TQ$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("TR16").Select
      SolverOk SetCell:="$TR$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$TR$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$TR$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$TR$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("UF16").Select
      SolverOk SetCell:="$UF$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$UF$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$UF$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$UF$1", Relation:=1, FormulaText:="87"
      SolverSolve (True)
  Range("UG16").Select
      SolverOk SetCell:="$UG$16", MaxMinVal:=3, ValueOf:=0.15, ByChange:="$UG$1", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$UG$1", Relation:=3, FormulaText:="74"
      SolverAdd CellRef:="$UG$1", Relation:=1, FormulaText:="87"
      SolverSolve (True) 
  </code></pre>
  
  <p>Thank you in advance for any help / advice.</p>