宏优化,如果它放慢了速度

时间:2019-02-24 19:32:45

标签: excel vba optimization

我很想优化此代码,以使其执行更快...

Sub gotocfstatement()

    If ActiveCell.Row < 10 Then Exit Sub

    If ActiveCell.Row > 5001 Then Exit Sub

    If Sheet1.Range("p" & (ActiveCell.Row)).Value = "" Then Exit Sub

    Application.ScreenUpdating = False
    Application.DisplayStatusBar = False

    Filename = Sheet1.Range("p" & (ActiveCell.Row)).Value

    Sheet2.Range("b9").Value = Filename

    If Sheet2.Range("b15").Value = "" Then
    Sheet2.Range("b14").Value = Sheet2.Range("s1").Value

    Else

    Sheet2.Range("b14").Value = Sheet2.Range("b15").Value

    End If

    If Sheet2.Range("a81").Value = "" Then
    Sheet2.Range("a85").Value = Sheet2.Range("ab1").Value

    Else

    Sheet2.Range("a85").Value = Sheet2.Range("a81").Value

    End If

    Sheets("cash flow statement").Select

Application.ScreenUpdating = True
Application.DisplayStatusBar = True

End Sub

0 个答案:

没有答案