无聊的疯子 发表于 2012-4-24 14:34
运行代码时先将自动计算关闭,运行完后再打开自动计算
由于代码是直接操作的单元格,
实际上即使先关闭自动计算,再打开自动计算,还是免不了要计算一遍,没有节省一点时间!
例:
Sub ss()
t = Timer
Application.Calculation = xlCalculationManual '设为手动计算
Set rg = Columns(16)
For x = 16 To 255 Step 2
Set rg = Union(rg, Columns(x))
Next x
Application.EnableEvents = False
rg.Font.ColorIndex = 5
Application.EnableEvents = True
Application.Calculation = xlAutomatic '设为自动计算
MsgBox Timer - t
End Sub
添上2段代码与否时间基本没变!
唯一出路是将大量公式用宏解决!