Sub 合并当前目录下所有工作簿的全部工作表()
Dim MyPath, MyName, AWbName
Dim Wb As Workbook, WbN As String
Dim G As Long, ShRcou As Long, ShCol As Integer
Dim Num As Long, WbSht 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
For G = 1 To Sheets.Count
WbSht = Replace(Left(MyName, Len(MyName) - 4), ".", "") & ";" & Wb.Sheets(G).Name
If .UsedRange.Count = 1 Then
ShCol = Wb.Sheets(G).UsedRange.Columns.Count
ShRcou
【求助帖】VBA合并工作簿问题
最新推荐文章于 2023-02-04 02:04:04 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)