Solver constraints don't work on protected sheet

A

adamaagard

Hi,

I have a macro that uses the solver to optimize a problem. I have
constraints set within the worksheet, and when I run the macro with the sheet
unprotected it produces values within the constraints. However, when I run
the macro when the sheet is protected, it doesn't follow the constraints.
Here is the macro:

Range("I3") = Range("C5")
SolverReset
SolverOk
SolverAdd CellRef:="I3", Relation:=1, FormulaText:="C4"
SolverAdd CellRef:="I3", Relation:=3, FormulaText:="C5"
SolverOk SetCell:="I5", MaxMinVal:=2, ByChange:="I3"
SolverSolve UserFinish:=True
SolverFinish

I3 is the cell that is being changed, C4 is a maximum, and C5 is a minimum.
Am I missing something, or is this just a glitch? Thanks for any help.
 
Top