Excel VBA 减少运行时间

Excel VBA decrease runtime

我正在将数据从一个工作簿复制并粘贴到另一个工作簿。不幸的是,我对我的运行时间不满意。特别是我的这部分代码需要很多时间。您有什么想法可以减少运行时间吗?

Function CopyData()

sws.Activate
Range("C4:GF4").Select
   Range(Selection, Selection.End(xlDown)).Select
   Selection.Copy

tws.Activate
Range("A12").Select
ActiveSheet.Paste

Range("D12:GD12").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,    SkipBlanks _
    :=False, Transpose:=False

End Function

这应该会提高性能,@EngJon 指的是不使用 select。

Function CopyData()
    Dim rng As Range

    Application.ScreenUpdating = False
    sws.Activate
    Range("C4:GF" & Range("GF" & Rows.Count).End(xlUp).Row).Copy
    tws.Activate
    Range("A12").PasteSpecial Paste:=xlPasteAll
    Set rng = Range("D12:GD" & Range("GD" & Rows.Count).End(xlUp).Row)
    rng.Value = rng.Value
    Application.ScreenUpdating = True
End Function