Solver VBA 隐藏对话框,仍然出现

Solver VBA hide dialog box, still appears

我知道有几个主题与此有关,但就我而言,它不起作用。我有一个宏来遍历一系列行,优化每个产品的价格。我不希望我的宏显示每一行的对话框。

Sub MultipleSolver()
Dim i As Integer
ActiveWorkbook.ActiveSheet.Activate
For i = 5 To 20
SolverReset
SolverOk SetCell:="$K$" & i, MaxMinVal:=1, ByChange:="$B$" & i, Engine:=1
SolverAdd CellRef:="$B$" & i, Relation:=1, FormulaText:="$E$" & i
SolverAdd CellRef:="$F$" & i, Relation:=1, FormulaText:="$G$" & i

SolverSolve UserFinish:=True

Cells(i, "L").Value = SolverSolve

Next i

End Sub

UserFinish:=True 应该省略对话框,但它仍然显示每一行的对话框。非常感谢!

一种方法可能是更改: SolverSolve UserFinish:=True -> SolverSolve (True)

根据线程SolverSolve UserFinish:=True--Solver Results Dialog Box Still Appears