怎样把excel的很多张sheet合并到一张sheet里面? 80
有好多个日期的sheet,内容格式都差不多就是日期和数据不同,想合并到一张sheet里面方便筛选我有超级多张sheet要弄到一起,有没有快捷的方法...
有好多个日期的sheet,内容格式都差不多就是日期和数据不同,想合并到一张sheet里面方便筛选
我有超级多张sheet要弄到一起,有没有快捷的方法 展开
我有超级多张sheet要弄到一起,有没有快捷的方法 展开
1个回答
2016-03-12 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
把所需合并的Excel文档放在同一个文件夹中,再文件夹中新建一个Excel打开Excel,按ALT+F11,或
依次点工具,宏,VB编辑器,弹出的编辑器中点插入模块,新弹出的空白窗口中输入以下代码:
Sub Com()
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("A65536").End(xlUp).Row + 2, 1) = Left(MyName,
Len(MyName) - 4)
For G = 1 To Wb.Sheets.Count
Wb.Sheets(G).UsedRange.Copy .Cells(.Range("A65536").End(xlUp).Row + 1, 1)
Next
WbN = WbN & Chr(13) & Wb.Name
Wb.Close False
End With
End If
MyName = Dir
Loop
Range("A1").Select
Application.ScreenUpdating = True
MsgBox "共合并了" &
Num & "个工作薄下的全部工作表。如下:" & Chr(13) & WbN, vbInformation,
"提示"
End Sub
保存---点执行键OK
依次点工具,宏,VB编辑器,弹出的编辑器中点插入模块,新弹出的空白窗口中输入以下代码:
Sub Com()
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("A65536").End(xlUp).Row + 2, 1) = Left(MyName,
Len(MyName) - 4)
For G = 1 To Wb.Sheets.Count
Wb.Sheets(G).UsedRange.Copy .Cells(.Range("A65536").End(xlUp).Row + 1, 1)
Next
WbN = WbN & Chr(13) & Wb.Name
Wb.Close False
End With
End If
MyName = Dir
Loop
Range("A1").Select
Application.ScreenUpdating = True
MsgBox "共合并了" &
Num & "个工作薄下的全部工作表。如下:" & Chr(13) & WbN, vbInformation,
"提示"
End Sub
保存---点执行键OK
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询