Question with Solver code using "Application.Run"



Hi all,

I have updated code that was working correctly to use Solver -- it was
updated because of potential issues that could exist from another user using
my spreadsheet on their system that has an earlier version of Excel. This
issue was highlighted on the "Peltier Technical Services" website.

I updated my code using the suggestions from the website to use
"Application.Run". The issue is that the results of the updated code are not
correct -- there are no errors, just the results are not right. Was
wondering if someone could take a look at the two different pieces of code
and let me know if they can see something that was not updated in the new
code correctly.

Old Code (working correctly):
SolverOk SetCell:="holdclearsumprod", MaxMinVal:=3,
ValueOf:=Range("AL1").Value, ByChange:="holdclearbin"
SolverAdd CellRef:="holdclearbin", Relation:=5, FormulaText:="binary"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001,
AssumeLinear _
:=False, StepThru:=False, Estimates:=1, Derivatives:=1, SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001, AssumeNonNeg:=False
SolverSolve userfinish:=True

Updated Code (not working correctly):
Application.Run "SolverReset"
Application.Run "SolverOk", "holdclearsumprod", 3, "AL1", "holdclearbin"
Application.Run "SolverAdd", "holdclearbin", 5, "binary"
Application.Run "SolverOptions", 100, 100, 0.000001, False, False, 1, 1, 1,
5, False, 0.0001, False
Application.Run "SolverSolve", True

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question