shanvan
Specifier/Regulator
- Nov 8, 2006
- 4
i'm trying to minimize a target cell with two constraints, with formulas in different columns. the solver works fine when i do it manually, but when i try to intergrate a macro, it screws up. it ignores one of my constraints. so the result is wrong.
my second problem is that i can't figure out how to loop the macro so that it repeats the same minimization, but to a different row. I have about 40 rows to compute.
This is the vba i have:
it's the first contraint (g78=1) that is ignored by the solver using the macro.
thanks
my second problem is that i can't figure out how to loop the macro so that it repeats the same minimization, but to a different row. I have about 40 rows to compute.
This is the vba i have:
Code:
SolverReset
SolverOk SetCell:="$I$78", MaxMinVal:=2, ValueOf:="0", ByChange:="$B$78:$F$78"
SolverAdd CellRef:="$G$78", Relation:=2, FormulaText:="1"
SolverAdd CellRef:="$A$78", Relation:=2, FormulaText:="$H$78"
SolverOk SetCell:="$I$78", MaxMinVal:=2, ValueOf:="0", ByChange:="$B$78:$F$78"
SolverSolve
End Sub
thanks