【问题标题】:VBA solver compilation errorVBA求解器编译错误
【发布时间】: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

我在代码中遗漏了什么吗?

【问题讨论】:

  • 在哪一行显示错误?
  • 您似乎缺少参考,请尝试从“工具”->“参考”添加求解器插件参考...
  • 谢谢伊姆兰...我错过了那部分...它解决了问题

标签: vba excel solver


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-28
    • 2020-02-28
    • 2015-05-14
    相关资源
    最近更新 更多