solver encountered an error in the objective cell or a constraint cell

ashultz

New Member
Joined
May 21, 2019
Messages
1
Hello All-

I'm hoping you can help me get to the bottom of a solver issue. I have a simple workbook that I created several years ago. After a few recent modifications, it no longer works. I get the "solver encountered an error in the objective cell or a constraint cell" error and cannot find the cause.

It will solve if I change it to "nonlinear" but the solution isn't optimized.

I'm looking for it to return the least cost option given a variety of feedstuffs and their nutrient analysis.

Here's the code:

Code:
Private Sub Solve_Click()


SolverReset
  
SolverOk SetCell:="$L$33", MaxMinVal:=2, ValueOf:=0, ByChange:="$C$37:$K$37", _
        Engine:=2, EngineDesc:="Simplex LP"


SolverAdd CellRef:="$C$37:K37", Relation:=1, FormulaText:="$C$35:k35"


SolverAdd CellRef:="$C$37:k37", Relation:=3, FormulaText:="$C$36:k36"


SolverAdd CellRef:="$C$36:$K$36", Relation:=3, FormulaText:=".001"


SolverAdd CellRef:="$L$4:L32", Relation:=1, FormulaText:="$I$42:I70"


SolverAdd CellRef:="$L$4:L32", Relation:=3, FormulaText:="$H$42:H70"


SolverAdd CellRef:="$L$37", Relation:=2, FormulaText:="$I$71"


SolverSolve


End Sub

Where lines 35, 36, 37 are the max, min, and calculated pounds of each component in each "batch". And H41 through I70 are the nutritional parameters.

THANK YOU in advance.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top