Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Solver ignores constraints in protected sheets XL 2003

Hi,

I have a simple VB program (sub) that uses solver to optimize a single
variable. The program allows the user to input constraints for max/min
bounds. When the worksheet is unprotected it runs fine, however, when the
sheet is protected the solver no longer stays within the specified max/min
constraints...

Sub Optimize()

If Range("E4") = "Shear" Then
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
ElseIf Range("E4") = "Moment" Then
Range("I3") = Range("C5")
SolverReset
SolverOk
SolverAdd CellRef:="I3", Relation:=1, FormulaText:="C4"
SolverAdd CellRef:="I3", Relation:=3, FormulaText:="C5"
SolverOk SetCell:="I4", MaxMinVal:=2, ByChange:="I3"
SolverSolve UserFinish:=True
SolverFinish
End If

End Sub

What needs to be done to ensure that the solver solution stays within the
constrained bounds, even when the sheet is protected?

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Solver ignores constraints in protected sheets XL 2003

...when the sheet is protected the solver no longer stays within
the specified max/min


Hi. I believe one of the test Solver looks at is
"ActiveSheet.ProtectContents."
If True, then Solver would not be able to change any of the "Changing
Cells."
I believe this is one of the reasons.

--
HTH :)
Dana DeLouis
Windows XP & Office 2007


"adamaagard" wrote in message
...
Hi,

I have a simple VB program (sub) that uses solver to optimize a single
variable. The program allows the user to input constraints for max/min
bounds. When the worksheet is unprotected it runs fine, however, when the
sheet is protected the solver no longer stays within the specified max/min
constraints...

Sub Optimize()

If Range("E4") = "Shear" Then
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
ElseIf Range("E4") = "Moment" Then
Range("I3") = Range("C5")
SolverReset
SolverOk
SolverAdd CellRef:="I3", Relation:=1, FormulaText:="C4"
SolverAdd CellRef:="I3", Relation:=3, FormulaText:="C5"
SolverOk SetCell:="I4", MaxMinVal:=2, ByChange:="I3"
SolverSolve UserFinish:=True
SolverFinish
End If

End Sub

What needs to be done to ensure that the solver solution stays within the
constrained bounds, even when the sheet is protected?

Thanks for any help.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solver Ignores Constraints Jerry W. Lewis Excel Discussion (Misc queries) 1 November 17th 07 04:30 AM
Solver Constraints twa14 Excel Discussion (Misc queries) 2 October 13th 07 01:10 PM
Excel Solver constraints Dan Excel Worksheet Functions 1 July 13th 07 03:50 PM
Solver: Can't add constraints when they are above/below certain va CK Excel Programming 0 January 24th 07 03:05 AM
Solver Constraints Rick Excel Discussion (Misc queries) 15 March 9th 05 03:17 PM


All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"