Excel表中合并两个Sheet的方法?

按Alt+F11,调出Visual Basic 界面。

在左侧窗口中,右键选择=="插入"---"模块"==:

将如下代码粘贴进去,点击运行按钮,完成数据表合并。

vbnet 复制代码
Sub MergeAllSheetsInThisWorkbook()
On Error Resume Next
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set st = Worksheets.Add(before:=Sheets(1))
st.Name = "merged"
For Each shet In Sheets:
If shet.Name <> "merged" Then
i = st.Range("A" & Rows.Count).End(xlUp).Row + 1
shet.UsedRange.Copy
st.Cells(i, 1).PasteSpecial Paste:=xlPasteAll
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "Done!!!"
End Sub
相关推荐
LingRannn6 小时前
【vim 中如何替换】
编辑器·vim·excel
yesyesido7 小时前
智能文件格式转换器:文本/Excel与CSV无缝互转的在线工具
开发语言·python·excel
开开心心_Every1 天前
免费进销存管理软件:云端本地双部署
java·游戏·微信·eclipse·pdf·excel·语音识别
Kasen's experience1 天前
Excel 怎么快速合并同一个ID不同行的大量相同单元格
excel
mudtools1 天前
基于.NET操作Excel COM组件生成数据透视报表
c#·.net·excel
yangminlei1 天前
Spring Boot+EasyExcel 实战:大数据量 Excel 导出(高效无 OOM)
spring boot·后端·excel
NignSah1 天前
Microsoft Excel World Championship 2025-2025EXCEL大赛,折纸
microsoft·excel
hhzz1 天前
Springboot项目中使用POI操作Excel(详细教程系列1/3)
spring boot·后端·excel·poi·easypoi
林月明1 天前
【VBA】点击一个按钮实现自动更新excel文件列数据
excel·vba·宏文件·一键数据更新
2501_907136821 天前
Word题库转换Excel
word·excel·软件需求