多个excel合并成一个
使用方法: 1.同一个路径下新建一个excel 2.开发工具 -> 查看代码 -> 点击sheet1 -> 输入下面的代码 -> F5 运行 3.合并成功 *.xls合并 Sub 合并当前目录下所有工作簿的全部工作表 ( ) Dim MyPath, MyName, AWbName Dim Wb As Workbook, WbN As String Dim G As Long Dim Num As Long Dim BOX As String Application.ScreenUpdating = False MyPath = ActiveWorkbook.Path MyName = Dir ( MyPath & "\" & " *.xls ") 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 .Cells(.Range(" B65536 ").End(xlUp).Row + 2, 1) = Left(MyName, Len(MyName) - 4) For G = 1 To