是否可以修改vba脚本,以便在定义' Solver'我可以使用'姓名'对于各种范围而不是绝对单元格引用?
在下面的示例中,各种范围在电子表格中定义为;
$A$1 ..... "obj_func"
$E$8:$E$11,$I$8:$M$11 ..... "bin_var", "qty_cut"
$C$8:$C$11 ..... "qty_used"
SolverOk SetCell:="$A$1", MaxMinVal:=2, ValueOf:=0, ByChange:= _
"$E$8:$E$11,$I$8:$M$11", Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:="$C$8:$C$11", Relation:=1, FormulaText:="stock_lengths"
答案 0 :(得分:0)
<强> UNTESTED 强>
尝试更换:
SolverAdd CellRef:="$C$8:$C$11", Relation:=1, FormulaText:="stock_lengths"
使用:
SolverAdd CellRef:=Range("qty_used").Address, Relation:=1, FormulaText:="stock_lengths"