×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Solver Non-Negative Variables - VBA command

Solver Non-Negative Variables - VBA command

Solver Non-Negative Variables - VBA command

(OP)
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.

RE: Solver Non-Negative Variables - VBA command

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: Eng-Tips.com Forum Policies
Chinese prisoner wins Nobel Peace Prize

RE: Solver Non-Negative Variables - VBA command

(OP)
I didn't see the "AssumeNonNeg" function in MSDN until you listed it.  It is there.  My Bad!  Thanks IRstuff.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources