Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Solver Non-Negative Variables - VBA command

Status
Not open for further replies.

zakk

Mechanical
May 3, 2002
48
I am writing an Excel 2010 VBA code that calls Solver and I need to tell Solver to uncheck the "Make Unconstrained Variables Non-Negative" box. The default is "True", ie. the box is checked. When I uncheck the box and run my code, and ask Solver to return the state of the box (SolverGet(TypeNum:=20)), it keeps coming back as "True". I can't find any function in the MSDN Library that will allow me to change it to "false". It seems you can change every other variable but this one. Any thoughts, as I have little experience in VBA.

The "Make Unconstrained Variables Non-Negative" feature is new in Excel 2007.
 
Replies continue below

Recommended for you

Why don't you use macro recorder to record what changes in the solver command? In 2007, the recorder recorded:
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:=True

TTFN

FAQ731-376
Chinese prisoner wins Nobel Peace Prize
 
I didn't see the "AssumeNonNeg" function in MSDN until you listed it. It is there. My Bad! Thanks IRstuff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor