0

Is it possible to amend the vba script so that in defining the parameters for 'Solver' I can used the 'Names' for the various ranges instead of the absolute cell references?

In the example below the various ranges are defined in the spreadsheet as;

$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"

1 Answer 1

1

UNTESTED

Try replacing:

SolverAdd CellRef:="$C$8:$C$11", Relation:=1, FormulaText:="stock_lengths"

with:

SolverAdd CellRef:=Range("qty_used").Address, Relation:=1, FormulaText:="stock_lengths"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.