【发布时间】:2014-03-15 01:20:11
【问题描述】:
我有以下代码,基本上是一个宏记录。录制宏后,我清理了一些发现重复的代码行。当我再次尝试运行此代码时,我得到一个未定义的子或函数错误。我在 Stackoverflow 上查看了其他 Solver VBA 问题,我似乎没有做错任何事情。有人可以帮忙吗?提前致谢。
Sub Macro2()
SolverOk SetCell:="$BF$7", MaxMinVal:=2, ValueOf:=0, ByChange:="$BA$7:$BC$7", Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:="$BA$7", Relation:=4, FormulaText:="integer"
SolverAdd CellRef:="$BA$7", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$BB$7", Relation:=4, FormulaText:="integer"
SolverAdd CellRef:="$BB$7", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$BC$7", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$BC$7", Relation:=4, FormulaText:="integer"
SolverAdd CellRef:="$BE$7", Relation:=3, FormulaText:="0"
SolverOk SetCell:="$BF$7", MaxMinVal:=2, ValueOf:=0, ByChange:="$BA$7:$BC$7", Engine:=2, EngineDesc:="Simplex LP"
SolverSolve
End Sub
【问题讨论】: