ns was utilizing VBA password to operation solver. Listed below is my code. I want cell C87:K93 to it is in integers, however, ns constrainns doens no get added into Solver so the values i get to be all decimals. Might i know exactly how i deserve to adjust the code therefore the ns integer constrainns get taken into account?

Sub Solve() SolverReset Solverinclude CellRef:=\"$C$87:$K$93\", Relation:=4, FormulaText:=\"integer\" Solveradd CellRef:=\"$C$87:$K$93\", Relation:=1, FormulaText:=\"$C$48:$K$54\" Solveradd CellRef:=\"$L$87:$L$93\", Relation:=1, FormulaText:=\"$M$87:$M$93\" Solveradd CellRef:=\"$C$87:$K$93\", Relation:=3, FormulaText:=\"0\" Solveryes sir SetCell:=\"$N$95\", MaxMinVal:=1, ValueOf:=\"0\", ByChange:=\"$C$87:$K$93\" Solverdeal with UserFinish:=Truefinish Subbelow ins ns connect to ns picture the Solver after to run the code, ns creature constraint simply doesn\"t show up

thanks therefore much because that helping




You are watching: Integer constraint cell reference must include only variable cells

vba excetogether essence constraints
Shto be
Folshort
edited Apr 9 \"14 at 15:24
\"*\"

SeanC
15.2k55 gold badges4242 silver- badges6363 bronze title
inquiry Apr 9 \"14 in ~ 14:56
\"*\"

user3515821user3515821
2911 silver badge22 bronze badges
2
add a commenns |

1 prize 1


energetic earliest Votes


See more: Zelda Breath Of The Wild Amiibo Cards, 22Pcs Pvc Nfc Tag Card The Legend Of Zelda

1
ns newly encountered the very same problem. Also withthe end having ns Formulamessage in ~ ns finish that the integer constraint.

This need to work:

Below Solve() SolverRecollection Solveryes sir SetCell:=\"$N$95\", MaxMinVal:=1, ValueOf:=\"0\", ByChange:=\"$C$87:$K$93\" Solveradd CellRef:=\"$C$87:$K$93\", Relation:=4 Solverinclude CellRef:=\"$C$87:$K$93\", Relation:=1, FormulaText:=\"$C$48:$K$54\" Solveradd CellRef:=\"$L$87:$L$93\", Relation:=1, FormulaText:=\"$M$87:$M$93\" Solveradd CellRef:=\"$C$87:$K$93\", Relation:=3, FormulaText:=\"0\" Solverfix UserFinish:=Trueend Subonce applying an integer constrainns (SolverAdd) to cell that to be not component the the decision variablens (ByChange), the solver prompts:

\"integer Constrainns cell referral should encompass just variable Cells.\"

This ins not ns case in your example, yet ns setting the objective function stiltogether plays a role. Ns i think the if you add ns integer constraint before you add ns SolverOk, ns solver does not understand the decisitop top variables (ByChange) however and Because of this doens no include the essence constraint.