title: EXCEL VBA Run Solver Over Multiple rows Using a Loop
body: <p>Hi All: I am completely brand new to VBA, so I used a macro recorder to help get a gist of the code I want.
  All of my inputs into Solver are in one row (e.g. row 19 of my worksheet). My objective cell is in column R, the decision cells are in columns E and F and the constraint is in column G. I eventually want to create more input rows, say 10, with 10 objective functions all in column R etc...
  I want to keep the columns fixed but create a loop that loops over the 10 rows, running solver for each row and then resets and runs the next row. When it reaches row 10 it checks to see if $R29 is "" if so it stops running.</p>
  
  <p>I know that I probably should use some form of "Do While Cells(Row,1) &lt;> "" " contruction, but I am at a losts how to create this simple loop in VBA.
  Thank you</p>
  
  <pre><code>    Sub RR_SC_OPTIMIZER()
  '
  ' RR_SC_OPTIMIZER Macro
  '
  
  '
      SolverOk SetCell:="$R$19", MaxMinVal:=2, ValueOf:=0, ByChange:="$E$19:$F$19", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverAdd CellRef:="$E$19", Relation:=1, FormulaText:="$G$19"
      SolverOk SetCell:="$R$19", MaxMinVal:=2, ValueOf:=0, ByChange:="$E$19:$F$19", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverOk SetCell:="$R$19", MaxMinVal:=2, ValueOf:=0, ByChange:="$E$19:$F$19", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
      SolverSolve
      SolverOk SetCell:="$R$19", MaxMinVal:=2, ValueOf:=0, ByChange:="$E$19:$F$19", _
          Engine:=1, EngineDesc:="GRG Nonlinear"
  End Sub
  </code></pre>