从宏更新Excel工作表时出错........?

时间:2018-03-15 00:22:28

标签: excel vba excel-vba

我有一个带有宏的Excel工作表,可以从其他excel文件更新时间轴,完成日期等信息。它工作正常,直到我得到这个:Pop up我只是一切都很好,但它现在打开一个对话框,我指定了文件路径所以我不知道我是否需要选择文件并打开它?

Dialog asking for file



Sub GetTimelineMemberFirst()

Dim wbXL As Excel.Workbook

'UPDATE w/ path to Files
    Set wbXL = CreateObject("S:\Premier\020218\Initial\17314 - Merger.xlsm")

    'Get IV timeline
    Sheets("Merger - Feb 2018").Unprotect
    Range("A17:G90").Select
    Selection.Clear
'UPDATE w/ SOW name
    Windows("17314 - Merger Merger Work statements.xlsm").Activate
    Sheets("Timeline").Select
    Range("A2:G80").Select
    Selection.Copy
    Windows("weekly spreadsheet.xls").Activate
'UPDATE w/ WCM tab name
    Sheets("Merger - Feb 2018").Select
    Range("A17").Select
    Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
       , SkipBlanks:=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
       :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("B17:B90").Select
    Selection.Delete Shift:=xlToLeft
    
    'get lead timeline
    Range("A349:G900").Select
    Selection.Clear
'UPDATE w/ SOW name
    Windows("17314 - Merger Merger Work statements.xlsm").Activate
    Sheets("Lead").Select
    Range("A1:G140").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("weekly spreadsheet.xls").Activate
'UPDATE w/ WCM tab name
    Sheets("Merger - Feb 2018").Select
    Range("A349").Select
    Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("B349:B900").Select
    Selection.Delete Shift:=xlToLeft
    
    Range("A79:F79").Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$79:$F$335").AutoFilter Field:=3, Criteria1:="="
    
    Range("A1").Select
    
    
    wbXL.Close
    
End Sub​




0 个答案:

没有答案