【发布时间】:2018-02-07 07:35:54
【问题描述】:
执行此 VBA 求解器代码时出现编译错误(未定义函数的子函数):
Sub Macro1()
SolverReset
SolverOk SetCell:="$H$6", _
MaxMinVal:=2, _
ValueOf:="0", _
ByChange:="$H$15:$H$20"
SolverAdd CellRef:="$H$15:$H$20", Relation:=4, FormulaText:="integer"
SolverAdd CellRef:="$H$15:$H$20", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$H$9", Relation:=3, FormulaText:="$I$9"
SolverAdd CellRef:="$H$10", Relation:=3, FormulaText:="$I$10"
SolverAdd CellRef:="$H$24", Relation:=2, FormulaText:="$I$24"
SolverAdd CellRef:="$H$25", Relation:=2, FormulaText:="$I$25"
SolverSolve userFinish:=True
End Sub
我在代码中遗漏了什么吗?
【问题讨论】:
-
在哪一行显示错误?
-
您似乎缺少参考,请尝试从“工具”->“参考”添加求解器插件参考...
-
谢谢伊姆兰...我错过了那部分...它解决了问题