Hi there, I hope you are keeping well. I have wrote a brief code that employs Solver (microsoft office 365).
It minimize an error adjusting a few parameters with one constraint. This loop is repeated for a range of date. The code runs, but I don't know why Solve became unstable and changed to maximize instead of minimze and the output (solution) in many cases is #NAVALUE!. I have put the instruction "Sheets("Tasa").Activate", but this not resolved the problem. Please, Can give me any hint or suggestion in order to fix the problem?. Many thanks!. Please find attached the file and below the code.

Sub Solver_Tasa()

Sheets("Tasa").Activate

Dim i As Long
Dim j As Long

For i = 4 To 23
For j = 4 To 23


SolverReset

SolverOk SetCell:=Range(Cells(13, i), Cells(13, i)), MaxMinVal:=2, ValueOf:=0, ByChange:=Range(Cells(7, i), Cells(12, i)).Address, Engine:=1, EngineDesc:="GRG Nonlinear"

SolverAdd CellRef:=Range(Cells(4, i), Cells(4, i)), Relation:=2, FormulaText:=Range(Cells(5, j), Cells(5, j)).Address


SolverOk SetCell:=Range(Cells(13, i), Cells(13, i)), MaxMinVal:=2, ValueOf:=0, ByChange:=Range(Cells(7, i), Cells(12, i)).Address, Engine:=1, EngineDesc:="GRG Nonlinear"

SolverOk SetCell:=Range(Cells(13, i), Cells(13, i)), MaxMinVal:=2, ValueOf:=0, ByChange:=Range(Cells(7, i), Cells(12, i)).Address, Engine:=1, EngineDesc:="GRG Nonlinear"

SolverSolve (True)

SolverSolve userFinish:=True
SolverFinish KeepFinal:=1

Next j
Next i
End Sub