贴出山版提供的代码 Private Sub CommandButton1_Click() Dim Sh As Worksheet For Each Sh In Worksheets Sh.Range("a2:k65536").ClearContents Next End Sub Private Sub CommandButton2_Click() Dim Sh As Worksheet, MyName$, ShName$, nRow% Application.DisplayAlerts = False Application.ScreenUpdating = False On Error Resume Next MyName = Dir(ThisWorkbook.Path & "\*.xls") Do While MyName <> "" If MyName <> ThisWorkbook.Name Then Workbooks.Open ThisWorkbook.Path & "\" & MyName With Workbooks(MyName) For Each Sh In .Worksheets nRow = Sh.Range("a65536").End(xlUp).Row arr = Sh.Range("a2:k" & nRow) ThisWorkbook.Sheets(Sh.Name).Range("a65536").End(xlUp).Offset(1).Resize(nRow - 1, 11) = arr Next .Close End With End If MyName = Dir Loop Me.Activate Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub |