D
david.i.schroeder
Hey everyone,
I am encountering a problem while running the following excel solver
macro which I recorded:
Sub Macro1()
SolverReset
SolverOk SetCell:="$BK$21", MaxMinVal:=1, ValueOf:="0", ByChange:=
_
"$BQ$17:$BQ$19"
SolverAdd CellRef:="$BQ$17:$BQ$19", Relation:=1, FormulaText:="1"
SolverAdd CellRef:="$BQ$17:$BQ$19", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$BQ$20", Relation:=2, FormulaText:="1"
SolverOk SetCell:="$BK$21", MaxMinVal:=1, ValueOf:="0", ByChange:=
_
"$BQ$17:$BQ$19"
SolverSolve
End Sub
While the solver works fine when run manually, the macro does not
arrive at the correct result. Looking up solver after the macro run
unveils that only one of the constraints (the second one) is loaded
into solver by the macro. The two other constraints miraculously
disappear. Any suggestions what I might do to fix this problem? I
really need it to work as it forms part of my master thesis :-(
Thank you very much in advance!
David
I am encountering a problem while running the following excel solver
macro which I recorded:
Sub Macro1()
SolverReset
SolverOk SetCell:="$BK$21", MaxMinVal:=1, ValueOf:="0", ByChange:=
_
"$BQ$17:$BQ$19"
SolverAdd CellRef:="$BQ$17:$BQ$19", Relation:=1, FormulaText:="1"
SolverAdd CellRef:="$BQ$17:$BQ$19", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$BQ$20", Relation:=2, FormulaText:="1"
SolverOk SetCell:="$BK$21", MaxMinVal:=1, ValueOf:="0", ByChange:=
_
"$BQ$17:$BQ$19"
SolverSolve
End Sub
While the solver works fine when run manually, the macro does not
arrive at the correct result. Looking up solver after the macro run
unveils that only one of the constraints (the second one) is loaded
into solver by the macro. The two other constraints miraculously
disappear. Any suggestions what I might do to fix this problem? I
really need it to work as it forms part of my master thesis :-(
Thank you very much in advance!
David