最低0.27元开通文库会员,查看完整内容> 原发布者:深夜醉醒 多个表格合并到一个表格中把所需合并的Excel文档放在同一个文件夹中,再文件夹中新建一个Excel打开Excel,按ALT+F11,或依次点工具,宏,VB编辑器,弹出的编辑器中点插入模块,新弹出的空白窗口中输入以下代码:SubCom()DimMyPath,MyName,AWbNameDimWbAsWorkbook,WbNAsStringDimGAsLongDimNumAsLongDimBOXAsStringApplication.ScreenUpdating=FalseMyPath=ActiveWorkbook.PathMyName=Dir(MyPath&"\"&"*.xls")AWbName=ActiveWorkbook.NameNum=0DoWhileMyName>""IfMyName>AWbNameThenSetWb=Workbooks.Open(MyPath&"\"&MyName)Num=Num+1WithWorkbooks(1).ActiveSheet.Cells(.Range("A65536").End(xlUp).Row+2,1)=Left(MyName,Len(MyName)-4)ForG=1ToWb.Sheets.CountWb.Sheets(G).UsedRange.Copy.Cells(.Range("A65536").End(xlUp).Row+1,1)NextWbN=WbN&Chr(13)&Wb.NameWb.CloseFalseEndWithEndIfMyName=DirLoopRange("A1").SelectApplication.ScreenUpdating=TrueMsgBox"共合并了"&Num&"个工作薄下的全部工作表。如下:"&Chr(13)&WbN,vbInformation,"提示"EndSub保存---点执行键OK