多个excel合并的教程
时间:2023-06-20 05:38:21
在Excel中录入好数据以后发现数据都在不同的Excel里统计数据非常不方便,这个时候就需要用到合并功能了。下面是小编带来的关于多个excel合并的教程,希望阅读过后对你有所启发!
多个excel合并的教程:
多个Excel合并步骤1:需要把多个excel表都放在同一个文件夹里面,并在这个文件夹里面新建一个excel。如图所示:
多个Excel合并步骤2:用microsoft excel打开新建的excel表,并右键单击sheet1,找到“查看代码”,单击进去。进去之后就看到了宏计算界面。如图所示:
多个Excel合并步骤3:然后把下面这些宏计算的代码复制进去,然后找到工具栏上面的“运行”下的“运行子过程/用户窗体”,代码如下,如图所示:
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 Sheets.Count
Wb.Sheets(G).UsedRange.Copy .Cells(.Range("B65536").End(xlUp).Row + 1, 1)
Next
WbN = WbN & Chr(13) & Wb.Name
Wb.Close False
End With
End If
MyName = Dir
Loop
Range("B1").Select
Application.ScreenUpdating = True
MsgBox "共合并了" & Num & "个工作薄下的全部工作表。如下:" & Chr(13) & WbN, vbInformation, "提示"
End Sub
多个Excel合并步骤4:运行之后,等待10秒针左右,等运行完毕,就是合并完成之后,会有提示,点确定就可以了。查看合并后的数据,有5000多行,就是同一个文件夹里面17个excel表数据合并后的结果。效果如图所示。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Excel里去掉最高分最低分再求平均分
![](https://img.aspxhome.com/file/2023/1/38371_0s.jpg)
Win11一共有几个版本?Windows11不同版本的区别介绍
![](https://img.aspxhome.com/file/2023/1/a283208_0s.jpg)
win10插u盘没有反应怎么办?win10插入u盘没有反应解决方法?
![](https://img.aspxhome.com/file/2023/2/47382_0s.jpg)
电脑版wps文档如何设置页脚文字的底色
![](https://img.aspxhome.com/file/2023/1/a182981_0s.png)
win7系统卸载软件提示用户权限不足没有管理员权限
![](https://img.aspxhome.com/file/2023/29/a253841_0s.jpg)
word文档怎么对文字进行字数统计?
![](https://img.aspxhome.com/file/2023/6/25066_0s.jpg)
解决U盘被写保护的三大妙招
![](https://img.aspxhome.com/file/2023/2/a287757_0s.png)
谷歌浏览器显示不安全怎样取消-谷歌浏览器显示不安全解决方法
![](https://img.aspxhome.com/file/2023/3/a300488_0s.png)
如何利用WPS制作PPT课件
![](https://img.aspxhome.com/file/2023/5/a186655_0s.jpg)
Win8系统升级Win10系统失败提示800703f1更新错误的解决方法
![](https://img.aspxhome.com/file/2023/2/a291131_0s.jpg)
怎么查看笔记本电脑的配置?
![](https://img.aspxhome.com/file/2023/2/a288143_0s.png)
excel2007冻结窗口在哪里?excel2007冻结窗口的方法
![](https://img.aspxhome.com/file/2023/6/a143586_0s.jpg)
word表格实现序列自动填充的技巧
如何格式化wps文本的段落
![](https://img.aspxhome.com/file/2023/2/a170982_0s.jpg)
excel表格如何在格里画一个长方形
Excel2019函数IFS怎么使用?Excel2019函数IFS使用教程
![](https://img.aspxhome.com/file/2023/1/40021_0s.jpg)
Win10一周年更新正式版14393.576已修复无网络连接的问题
![](https://img.aspxhome.com/file/2023/29/a260775_0s.jpg)
Win11如何禁用开机启动项?Win11禁用开机启动设置
![](https://img.aspxhome.com/file/2023/27/a236002_0s.jpg)
excel2007怎么计算平均分
Win10 RS4首个官方ISO镜像下载地址 32/64位
![](https://img.aspxhome.com/file/2023/28/a241735_0s.jpg)