解算器:发生意外的内部错误,或可用内存耗尽

时间:2014-10-19 10:22:06

标签: excel vba

我正在尝试在VBA中使用Excel中的求解器,但我遇到了麻烦。我不断收到以下错误:“解算器:发生了意外的内部错误,或者可用内存耗尽。”

现在,我猜解算器并没有内存不足,因为我可以在使用求解器对话框时解决同样的问题。

这是我的代码:

Sub CoolSolverButton()

SolverReset

SolverOK setCell:=Range("$CK$203"), MaxMinVal:=1, ByChange:=Range("$BH$203:$BQ$222"), Engine:=2, EngineDesc:="Simplex LP"

SolverAdd CellRef:=Range("$BH$203:$BQ$222"), relation:=5, FormulaText:="binary"
SolverAdd CellRef:=Range("$BH$223:$BQ$223"), relation:=1, FormulaText:=Range("$BH$225:$BQ$225")
SolverAdd CellRef:=Range("$BH$227:$BH$245"), relation:=1, FormulaText:=Range("$BI$227:$BI$245")
SolverAdd CellRef:=Range("$BJ$227:$BJ$245"), relation:=1, FormulaText:=Range("$BK$227:$BK$245")
SolverAdd CellRef:=Range("$BL$227:$BL$245"), relation:=1, FormulaText:=Range("$BM$227:$BM$245")
SolverAdd CellRef:=Range("$BN$227:$BN$245"), relation:=1, FormulaText:=Range("$BO$227:$BO$245")
SolverAdd CellRef:=Range("$BP$227:$BP$245"), relation:=1, FormulaText:=Range("$BQ$227:$BQ$245")
SolverAdd CellRef:=Range("$BR$203:$BR$222"), relation:=2, FormulaText:=Range("$BT$203:$BT$222")
SolverAdd CellRef:=Range("$BU$203:$BU$222"), relation:=2, FormulaText:=Range("$BW$203:$BW$222")

SolverSolve UserFinish:=True

SolverFinish KeepFinal:=1

End Sub

有什么想法吗?

谢谢!

0 个答案:

没有答案