Hi
Be grateful if someone could tell me why this code is not working. I have a number of 36 month periods and I want solver to work through each of them and return the solver results after each one before moving on to the next 36 month period.
Thanks!
Sub Analysis()
Worksheets("Main").Activate
RowCount = 136
Do While Not IsEmpty(Worksheets("Main").Range("A" & RowCount))
SolverReset
SolverOptions precision:=0.001
SolverOk SetCell:=Range("L" & RowCount), _
MaxMinVal:=2, _
ByChange:=Array("B:I" & RowCount)
SolverAdd CellRef:=Array("B:I" & RowCount), _
Relation:=1, _
FormulaText:="1"
SolverAdd CellRef:=Array("B:I" & RowCount), _
Relation:=3, _
FormulaText:="0"
SolverAdd CellRef:=Range("J" & RowCount), _
Relation:=2, _
FormulaText:="1"
SolverSolve userFinish:=True
SolverFinish keepFinal:=1
RowCount = RowCount + 38
Loop
MsgBox "Solved"
End Sub
Bookmarks