Dana DeLouis said:
I think you want to use the following:
SolverSolve True
If you wish to use the results with "SolverFinish", then here is just one
idea.
Sub Demo()
'// Dana DeLouis
Dim WhatHappened
Const KeepSolution = 1
Const DiscardSolution = 2
'// Don't display Solver
WhatHappened = SolverSolve(True)
Select Case WhatHappened
Case 1 To 3
'Solution should be ok
SolverFinish KeepSolution
Case Else
SolverFinish DiscardSolution
End Select
End Sub
HTH. :>)
Hello!
Having problems with code...how to use the command above?
i have this kind of code now:
Private Sub CommandButton1_Click()
Worksheets("Taul2").Activate
SolvReset
SolvOptions AssumeNonNeg:=True
SolvOk SetCell:="B22", MaxMinVal:=3, ValueOf:="0",
ByChange:="B5,B7,B9"
SolvAdd CellRef:="B4", Relation:=2, FormulaText:="B6"
SolvAdd CellRef:="B5", Relation:=2, FormulaText:="B8"
SolvSolve
SolvReset
SolvOptions AssumeNonNeg:=True
SolvOk SetCell:="C22", MaxMinVal:=3, ValueOf:="0",
ByChange:="C5,C7,C9"
SolvAdd CellRef:="C4", Relation:=2, FormulaText:="C6"
SolvAdd CellRef:="C5", Relation:=2, FormulaText:="C8"
SolvSolve