ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SolverSolve return values (https://www.excelbanter.com/excel-programming/371280-solversolve-return-values.html)

Steve M

SolverSolve return values
 
I have a macro where I use the Solver multiple times. I would like to
capture the value that SolverSolve returns (I understand that there are 1 of
13 values returned by the SolverSolve command) in order to determine how my
macro should respond. Does any know how to capture the returned value? I
currently use the following:

If SolverSolve(UserFinish:=True) = 4 Then.....

This works but if I use this approcah for each condition the SolverSolve
command appears to run for each statement. I would like to capture this
returned value to evaluate without re-running the solver for each test.

Thanks for you help.
Steve

Jon Peltier

SolverSolve return values
 
Dim iSolverSolve As Long
iSolverSolve = SolverSolve(UserFinish:=True)
Select Case iSolverSolve
etc.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Steve M" wrote in message
...
I have a macro where I use the Solver multiple times. I would like to
capture the value that SolverSolve returns (I understand that there are 1
of
13 values returned by the SolverSolve command) in order to determine how
my
macro should respond. Does any know how to capture the returned value? I
currently use the following:

If SolverSolve(UserFinish:=True) = 4 Then.....

This works but if I use this approcah for each condition the SolverSolve
command appears to run for each statement. I would like to capture this
returned value to evaluate without re-running the solver for each test.

Thanks for you help.
Steve





All times are GMT +1. The time now is 08:40 PM.

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