如何使此宏运行更快?

时间:2018-11-27 20:53:33

标签: excel vba excel-vba

现在大约需要3分钟,我认为不应该花那么长时间。我在做什么错了?

我要复制一列日期,然后提取时间,日期,月份和年份。

Sub Date_Conversion()
'
' Date_Conversion Macro
'

'
    Sheets("PTP Calc").Visible = True
    Application.ScreenUpdating = False

    Sheets("Agent Inbound Call Detail-Agent").Select
    Range("A3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy

    Sheets("PTP Calc").Select
    Range("A3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ' Columns("A:A").EntireColumn.AutoFit
    Range("B3").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=MONTH(RC[-1])"
    Range("B3").Select
    'added line below
    Selection.AutoFill Destination:=Range("B3:B4690")
    'Range("B3:B4690").Select
    Range("C3").Select
    ActiveCell.FormulaR1C1 = "=DAY(RC[-2])"
    Range("C3").Select
    Selection.AutoFill Destination:=Range("C3:C4690")

    Range("D3").Select
    ActiveCell.FormulaR1C1 = "=HOUR(RC[-3])"
    Range("D3").Select
    Selection.AutoFill Destination:=Range("D3:D4690")

    Range("E3").Select
    ActiveCell.FormulaR1C1 = "=IF(RC[-1]>=12,""PM"",""AM"")"
    Range("E3").Select
    Selection.AutoFill Destination:=Range("E3:E4690")


    Range("F3").Select
    ActiveCell.FormulaR1C1 = "=TEXT(RC[-5],""dddd"")"
    Range("F3").Select
    Selection.AutoFill Destination:=Range("F3:F4690")


    Sheets("PTP Calc").Visible = False
    Sheets("Per Tech Performance").Select


End Sub

0 个答案:

没有答案