Excel VBA – 额外的表格导致我的VBA运行速度变慢

我有一个运行速度非常快的macros,当我运行一个与2张交互的VBA子/函数时,但是当我添加其他与子计算无关的工作表时,子执行时间会延长10倍。 我试图禁用其他工作表让我的子/function更快,但我找不到解决scheme。 任何人都可以帮助我? 提前致谢。

这是我的代码,join其他表格的速度变慢的部分:

Dim i, j, k As Integer 'Fluxo de Caixa iterators i = 11 j = 10 'DB interators k = 2 'cachFlowRef row rowReference = Range("cashFlowRef").Row Debug.Print timer.TimeElapsed Do Until Cells(i, 2) = "T" If Cells(i, 2) <> "" Then Do Until Cells(rowReference, j).Value = "" If Cells(i, j).Value <> 0 Then With Sheets("FLUXO_DB") .Cells(k, 1).Value = Cells(i, 2).Value 'tipo .Cells(k, 2).Value = Cells(i, 3).Value 'plano de contas .Cells(k, 3).Value = Cells(i, j).Value 'valor .Cells(k, 4).Value = Cells(3, j).Value 'data .Cells(k, 5).Value = getTrimestre(Cells(10, j).Value) 'trimestre .Cells(k, 6).Value = Year(Cells(10, j).Value) 'ano End With k = k + 1 End If j = j + 1 Loop End If j = 10 i = i + 1 Loop Debug.Print timer.TimeElapsed 

Application.Calculation = xlManual添加到代码的开头

并添加Application.Calculation = xlAutomatic到最后。