ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Solver VB interface 'SolverOK' fails (https://www.excelbanter.com/excel-programming/330634-solver-vbulletin-interface-solverok-fails.html)

XydQyv

Solver VB interface 'SolverOK' fails
 
I am currently using code of the form below to run solver multiple times.
The problem that I am having is that the 'SolverOK' function does not modify
the solver form. Running the code causes no change in the desired cells.
Several permutations of the code have caused the referenced cells' values to
be replaced by the string of the cells' addresses. This is running on
MSVB6.0 with Excel 2000 9.06926 SP-3) on Windows 2000 5.00.2195, SP-3.

After this code runs, the 'Set Target cell' and 'By Changing Cells' fields
are blank.
Call SOLVER.SolverReset
Call SOLVER.SolverOK("$A$4", 3, 0#, "$B$6")
Call SOLVER.SolverAdd("$C$36", 2, "$C$38")
Call SOLVER.SolverSolve(True)
Call SOLVER.SolverSave("$C$45")

Any help, relating, or sympathy would be greatly appreciated...

Mike Middleton[_4_]

Solver VB interface 'SolverOK' fails
 
XydQyv -

Chris Albright discusses a similar problem in his book "VBA for Modelers:
Developing Decision Support Systems with Microsoft Excel." His solution is
to repeat the first two lines of code, so the first four lines would be
Reset, OK, Reset, OK.

- Mike
www.mikemiddleton.com

"XydQyv" wrote in message
...
I am currently using code of the form below to run solver multiple times.
The problem that I am having is that the 'SolverOK' function does not
modify
the solver form. Running the code causes no change in the desired cells.
Several permutations of the code have caused the referenced cells' values
to
be replaced by the string of the cells' addresses. This is running on
MSVB6.0 with Excel 2000 9.06926 SP-3) on Windows 2000 5.00.2195, SP-3.

After this code runs, the 'Set Target cell' and 'By Changing Cells' fields
are blank.
Call SOLVER.SolverReset
Call SOLVER.SolverOK("$A$4", 3, 0#, "$B$6")
Call SOLVER.SolverAdd("$C$36", 2, "$C$38")
Call SOLVER.SolverSolve(True)
Call SOLVER.SolverSave("$C$45")

Any help, relating, or sympathy would be greatly appreciated...




Dana DeLouis[_3_]

Solver VB interface 'SolverOK' fails
 
Just out of curiosity, what does your MsgBox returned. Is it False?

Sub Demo()
'// See if it's False
MsgBox SOLVER.AutoOpened
'// Then try...
SOLVER.Auto_open
'// Your code here...
End Sub

--
Dana DeLouis
Win XP & Office 2003


"XydQyv" wrote in message
...
I am currently using code of the form below to run solver multiple times.
The problem that I am having is that the 'SolverOK' function does not
modify
the solver form. Running the code causes no change in the desired cells.
Several permutations of the code have caused the referenced cells' values
to
be replaced by the string of the cells' addresses. This is running on
MSVB6.0 with Excel 2000 9.06926 SP-3) on Windows 2000 5.00.2195, SP-3.

After this code runs, the 'Set Target cell' and 'By Changing Cells' fields
are blank.
Call SOLVER.SolverReset
Call SOLVER.SolverOK("$A$4", 3, 0#, "$B$6")
Call SOLVER.SolverAdd("$C$36", 2, "$C$38")
Call SOLVER.SolverSolve(True)
Call SOLVER.SolverSave("$C$45")

Any help, relating, or sympathy would be greatly appreciated...





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

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