Estimados, buen día. Espero se encuentren muy bien junto a sus familias. Necesito ayuda por favor. He escrito un breve código que llama a solver para minimizar un error ajustando unos cuantos parámetros y con una restricción. Esta minimización se debería repetir diariamente para un rango de fechas. No sé la razón por la cual solver se vuelve inestable y maximiz a la función en vez de minimizar y como resultado #¡VALOR!. .Me podrían por favor orientar o sugerir una solución al problema planteado. Abajo el código y se adjunta el archivo excel. Muchas gracias.
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
Adjunto | Tamaño |
---|---|
![]() | 71.59 KB |