我有以下宏来运行不同概率的各种情况。基本上,它针对各种情况场景运行216个案例(每个案例4次),方法是增加3个不同单元格中的值,然后让求解器计算其后的最佳回报。它适用于1次迭代,但有864次迭代,这就是问题发生的地方。
每次迭代后,我都会弹出对话框,说解算器找到了最佳匹配,我想做什么。我的问题是,是否有任何方法可以禁用弹出窗口?
代码:
Sub Macro9()
'
' Macro9 Macro
'
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
a = 0
b = 0
c = 0
d = 1
While a <= 30
Range("B21") = a
While b <= 30
Range("B22") = b
While c <= 30
Range("B23") = c
SolverOk SetCell:="$I$24", MaxMinVal:=1, ValueOf:=0, ByChange:="$B$14:$B$20", _
Engine:=3, EngineDesc:="Evolutionary"
SolverSolve
SolverOk SetCell:="$I$24", MaxMinVal:=1, ValueOf:=0, ByChange:="$B$14:$B$20", _
Engine:=3, EngineDesc:="Evolutionary"
SolverSolve
SolverOk SetCell:="$I$24", MaxMinVal:=1, ValueOf:=0, ByChange:="$B$14:$B$20", _
Engine:=3, EngineDesc:="Evolutionary"
SolverSolve
SolverOk SetCell:="$I$24", MaxMinVal:=1, ValueOf:=0, ByChange:="$B$14:$B$20", _
Engine:=3, EngineDesc:="Evolutionary"
SolverSolve
Cells(27, d) = d
e = 28
While e <= 37
Cells(e, d) = Cells(e - 14, 2)
e = e + 1
Wend
Cells(38, d) = Range("I24")
c = c + 5
d = d + 1
Wend
b = b + 5
c = 0
Wend
a = a + 5
b = 0
c = 0
Wend
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
系统信息:Excel 2010