Hi im having trouble with solver when i want a optimazation through solver and vba codes
Actually it works ok when i push the button in data tap, and solver button.
But it does make an error when i want to call solver in vba.
the error is called
"Solver: An unexpected internal error occurred, or available memory was exhausted."
and occurs when the code tries to add binary constrains.
=====================================================
Range("U37:V46").Select
Selection.FormulaR1C1 = "0"
SolverReset
SolverOk SetCell:="$Z$44", MaxMinVal:=2, ValueOf:=0, ByChange:="$U$37:$V$46", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$Y$37:$Y$46", Relation:=2, FormulaText:="1"
SolverOk SetCell:="$Z$44", MaxMinVal:=2, ValueOf:=0, ByChange:="$U$37:$V$46", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$Z$37:$AA$41", Relation:=2, FormulaText:="1"
SolverOk SetCell:="$Z$44", MaxMinVal:=2, ValueOf:=0, ByChange:="$U$37:$V$46", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$Z$42:$AA$42", Relation:=2, FormulaText:="5"
SolverOk SetCell:="$Z$44", MaxMinVal:=2, ValueOf:=0, ByChange:="$U$37:$V$46", _
Engine:=1, EngineDesc:="GRG Nonlinear"
MsgBox ("1")
SolverAdd CellRef:="$U$37:$V$46", Relation:=5, FormulaText:="2진수"//occurs an error "2진수" means "binary"
SolverOk SetCell:="$Z$44", MaxMinVal:=2, ValueOf:=0, ByChange:="$U$37:$V$46", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$Z$44", MaxMinVal:=2, ValueOf:=0, ByChange:="$U$37:$V$46", _
Engine:=1, EngineDesc:="GRG Nonlinear"
solversolve
MsgBox ("7")
solversolve UserFinish:=True
SolverFinish KeepFinal:=1
========================================================
I tried to find a solution for this for a week.
here is what i did for solving problem.
i checked solver is installed ok. and the reference is also ok.
1. try to add "application.run" above the codes.
it didnt work.
2. reparing office 2016.
it didnt work.
3. re-installing office 2016.
it didnt work.
4. I send some mails to "Frontline System" since "solver" is a third-party app not Microsoft app now.
And they suggested re-installing and cutting/pasting "meta data" located C:\Users\<user name>\AppData\Roaming\Microsft\Excel
and reopening excel and try the macro again.
but it didnt work either.
and they said unfortunately that i would need to contact the Microsoft Help Desk but i couldnt get support since i am personal user and the issue is about developing.
Any advice will help me a lot.