ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SolverSolve function exits abnormally (https://www.excelbanter.com/excel-programming/402194-solversolve-function-exits-abnormally.html)

Ashish Dutt Sharma

SolverSolve function exits abnormally
 
Hello all,

I am running an optimization problem and am using function to iterate solver.

-------------------------------------------------------------------------
Private Function RunSolverNoLimit(vCosts As String, vVols As String, vChk As
String, vSales As String)

Application.ScreenUpdating = False

SolverReset
SolverOk SetCell:=vCosts, MaxMinVal:=2, ByChange:=vVols, Engine:=2

SolverOptions AssumeNonNeg:=True

SolverAdd CellRef:=vChk, Relation:=2, FormulaText:=vSales

SolverSolve UserFinish:=True
Solverfinish Keepfinal:=1

Application.ScreenUpdating = True

End Function
-------------------------------------------------------------------------

All the arguments are Named ranges in the same sheet as the function.
This code is working in one file but not in the other.

In the new file, the function just dies out after SolverSolve, never
reaching SolverFinish. It does solve the problem though.

Interestingly, when I track the function by 'Stepping in', I can run the
SolverSolve in the debug box and it works without ending the function.
However if the line in the function executes, the optimization goes through
but the routine just exits (and I mean it doesn't go back to the calling
function; instead the whole run ends).

Any ideas?

Best regards,
Ashish


All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com