One of the equations in a Solver model that I am creating in an Excel VBA macro is as follows:
SolverAdd CellRef:="$M$18:$M$30", Relation:=2, FormulaText:="$N$18:$N$30"
How could I implement it so that the row number "18" is a value that can be read as an input from another cell? For example, cell A1 may have the value 18, which is what I want used in this equation. If the value in A1 was 10, then the equation should read as:
SolverAdd CellRef:="$M$10:$M$30", Relation:=2, FormulaText:="$N$10:$N$30"
Similarly, the variables are defined as:
SolverOk SetCell:="$H$47", MaxMinVal:=2, ValueOf:=0, ByChange:="$H$18:$J$30,$R$18:$R$30", _
Engine:=1, EngineDesc:="Simplex LP"
Again, when the value of the number in cell A1 changes from, say 18 to 10, the
variables should change from "$H$18:$J$30,$R$18:$R$30"
to "$H$10:$J$30,$R$10:$R$30"
.
I will greatly appreciate any suggestions.
Thanks a lot.