I need to use the solver code for 100 rows. In the optimization process the target cell, the changing cells and the two cells included in the constraints change its value for each iteration. Below I present a possible code, but the software says me that there is some mistakes. How Can I solve this problem?
VBA CODE :
Sub opt()
For i = 0 To 100
SolverReset
SolverOk SetCell:=Cells(i + 10, 19), MaxMinVal:=1, ByChange:=Range(Cells(i + 10, 2), Cells(i + 10, 13))
SolverAdd Cellref:=Cells(i + 10, 14), Relation:=2, FormulaText:=Cells(2, 14)
SolverAdd Cellref:=Cells(i + 10, 17), Relation:=2, FormulaText:=Cells(i + 10, 16)
SolverFinish KeepFinal:=1
Next i
End Sub
VBA CODE :
Sub opt()
For i = 0 To 100
SolverReset
SolverOk SetCell:=Cells(i + 10, 19), MaxMinVal:=1, ByChange:=Range(Cells(i + 10, 2), Cells(i + 10, 13))
SolverAdd Cellref:=Cells(i + 10, 14), Relation:=2, FormulaText:=Cells(2, 14)
SolverAdd Cellref:=Cells(i + 10, 17), Relation:=2, FormulaText:=Cells(i + 10, 16)
SolverFinish KeepFinal:=1
Next i
End Sub