代码如下:每合并一个文件 就会蹦出这个提示框。每次只要点掉就没事了,最后的结果也是正确的。想知道在code哪里作调整,可以关掉这个notification。谢谢了!
Sheets("Sheet1").Select
Columns("A:AK").Delete
Dim MyPath, MyName, AWbName
Dim Wb As Workbook, WbN As String
Dim Num As Long
Application.ScreenUpdating = False
MyPath = ActiveWorkbook.Path
MyName = Dir(MyPath & "\" & "*.xlsm")
AWbName = ActiveWorkbook.Name
Num = 0
Do While MyName <> ""
If MyName <> AWbName Then
Set Wb = Workbooks.Open(MyPath & "\" & MyName)
Num = Num + 1
With Workbooks(1).ActiveSheet
Dim x As Integer
x = Range("B65536").End(xlUp).Row
Wb.Sheets("MMC").Range("B7:X" & x).Copy .Cells(.Range("B65536").End(xlUp).Row + 1, 1)
WbN = WbN & Chr(13) & Wb.Name
Wb.Close False
End With
End If
MyName = Dir
Loop
Range("B1").Select
Application.ScreenUpdating = True
MsgBox "This action has combined the " & Num & " files below. Please refer to :" & Chr(13) & WbN, vbInformation, "Notification"
Sheets("MMC before loading").Select
Range("B2:X2").Select
Range(Selection, Selection.End(xlDown)).ClearContents
Sheets("Sheet1").Select
Range("A2:W2").Select
Range("W2").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("MMC before loading").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
Sheets("Sheet1").Select
Columns("A:AK").Delete
Dim MyPath, MyName, AWbName
Dim Wb As Workbook, WbN As String
Dim Num As Long
Application.ScreenUpdating = False
MyPath = ActiveWorkbook.Path
MyName = Dir(MyPath & "\" & "*.xlsm")
AWbName = ActiveWorkbook.Name
Num = 0
Do While MyName <> ""
If MyName <> AWbName Then
Set Wb = Workbooks.Open(MyPath & "\" & MyName)
Num = Num + 1
With Workbooks(1).ActiveSheet
Dim x As Integer
x = Range("B65536").End(xlUp).Row
Wb.Sheets("MMC").Range("B7:X" & x).Copy .Cells(.Range("B65536").End(xlUp).Row + 1, 1)
WbN = WbN & Chr(13) & Wb.Name
Wb.Close False
End With
End If
MyName = Dir
Loop
Range("B1").Select
Application.ScreenUpdating = True
MsgBox "This action has combined the " & Num & " files below. Please refer to :" & Chr(13) & WbN, vbInformation, "Notification"
Sheets("MMC before loading").Select
Range("B2:X2").Select
Range(Selection, Selection.End(xlDown)).ClearContents
Sheets("Sheet1").Select
Range("A2:W2").Select
Range("W2").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("MMC before loading").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub