跳到主要内容

如何在Excel中合并具有相同标题的多个工作表?

例如,您在不同的工作表中具有一些具有相同标题的数据,如下面的屏幕截图所示,现在您的工作是将这些工作表合并为一个工作表。 本教程没有一个一个地复制和粘贴它们,而是为您介绍了处理此工作的更好方法。

doc合并相同的标头1
doc合并相同的标头2
doc合并相同的标头3

通过VBA合并具有相同标题的工作表

通过合并功能合并具有相同标题的Excel工作表

通过Kutools for Excel合并或合并具有相同标题的Excel工作表 好主意3


箭头蓝色右气泡 通过VBA合并具有相同标题的工作表

如果您只想合并具有相同标题的图纸而无需任何计算,则可以应用VBA代码来解决。

1.激活要合并图纸的工作簿,然后按 Alt + F11键 打开钥匙 Microsoft Visual Basic应用程序 窗口。

2。 点击 插页 > 模块,然后将以下VBA代码粘贴到新 模块 窗口。

VBA:合并具有相同标题的工作表

Sub Combine()
'UpdateByKutools20151029
    Dim i As Integer
    Dim xTCount As Variant
    Dim xWs As Worksheet
    On Error Resume Next
LInput:
    xTCount = Application.InputBox("The number of title rows", "", "1")
    If TypeName(xTCount) = "Boolean" Then Exit Sub
    If Not IsNumeric(xTCount) Then
        MsgBox "Only can enter number", , "Kutools for Excel"
        GoTo LInput
    End If
    Set xWs = ActiveWorkbook.Worksheets.Add(Sheets(1))
    xWs.Name = "Combined"
    Worksheets(2).Range("A1").EntireRow.Copy Destination:=xWs.Range("A1")
    For i = 2 To Worksheets.Count
        Worksheets(i).Range("A1").CurrentRegion.Offset(CInt(xTCount), 0).Copy _
               Destination:=xWs.Cells(xWs.UsedRange.Cells(xWs.UsedRange.Count).Row + 1, 1)
    Next
End Sub

3。 按 F5 键以运行VBA,并弹出一个对话框供您输入标题行的编号。 看截图:

doc合并相同的标头4

4。 点击 OK。 活动工作簿中的所有工作表都合并到一个名为 “结合”.

doc合并相同的标头1
文档加
doc合并相同的标头2
文档加
doc合并相同的标头3
doc垂直相等
doc合并相同的标头3

提示:

(1.)您的数据必须从A1开始,否则,该代码将无效。

(2.)您的数据必须具有相同的结构。

(3.)此代码只能合并活动工作簿的所有工作表,如果要合并多个工作簿中的工作表,则此代码将不起作用。


箭头蓝色右气泡 通过合并功能合并具有相同标题的Excel工作表

假设您有一些数据具有相同的列标题和行标题,如下面的屏幕截图所示,并且想要合并具有相同标题的excel工作表,然后进行一些计算,则可以在Excel中应用Consolidate函数。

doc合并相同的标头6
doc合并相同的标头7
doc合并相同的标头8

1.打开要从中合并工作表的所有工作簿,然后将光标放在要查找合并数据的空白单元格中,然后单击“确定”。 时间 > 整合。 看截图:

doc合并相同的标头9

2.然后在 整合 窗口,执行以下操作:

1)选择您想要的计算形式 功能 清单

2)单击以选择要合并的范围。

3)点击 地址 按钮将范围添加到“所有参考”列表中。 重复步骤2)和步骤3),以添加合并到此列表所需的所有范围。

4)检查 第一排左栏在中使用标签 部分。

5)如果要将链接的数据链接到源数据,请检查 创建到源数据的链接.

doc合并相同的标头10
doc合并相同的标头11
1)选择您想要的计算形式 功能 清单

2)单击以选择要合并的范围。

3)点击 地址 按钮将范围添加到“所有参考”列表中。 重复步骤2)和步骤3),以添加合并到此列表所需的所有范围。

4)检查 第一排左栏在中使用标签 部分。

5)如果要将链接的数据链接到源数据,请检查 创建到源数据的链接.

3。 点击 OK。 现在,所有具有相同标题的数据范围将合并为一个,并按标题进行汇总。

doc合并相同的标头6doc合并相同的标头7doc合并相同的标头8
doc垂直相等
doc合并相同的标头12

箭头蓝色右气泡 通过Kutools for Excel合并或合并具有相同标题的Excel工作表

如果在某些情况下只想合并具有相同标题的数据,而在其他情况下又想合并数据并合并它们,是否有任何技巧可以解决这两个任务? 这里我介绍 Kutools for Excel很强大 结合 功能为你。

合并具有相同标题的Excel工作表

合并具有相同页眉的多个工作表

Kutools for Excel, 与超过 300 方便的功能,使您的工作更加轻松。 

安装后 Kutools for Excel,请执行以下操作:(立即免费下载Kutools for Excel!)

合并具有相同标题的Excel工作表

1。 点击 Kutools 加 > 结合 启用组合向导,然后检查 将工作簿中的多个工作表合并为一个工作表。 查看屏幕截图:
doc合并相同的标头14
doc kutools结合2

2。 点击 下一个>> 合并工作表-第2步,共3步 向导,然后执行以下操作:

doc kutools结合3
1)点击 地址 > 文件夹 添加工作簿,您可以将工作表从合并到 工作簿清单;
2)检查要合并工作表的工作簿名称,可以选择多个工作簿;
3)检查要合并在一起的工作表;
4)点击 doc选择 选择要合并的范围,如果范围位于每张纸的相同位置,则只需从一张纸中选择一个范围,然后单击 相同范围.

3。 点击 下一个>> 合并工作表-第3步,共3步 向导,然后检查 按行合并选项 和类型 1 进入的文本框 标题行号,如果您的范围内没有标题,请在其中输入0。

doc kutools结合4

4。 点击 完成,然后会弹出一个对话框提醒您保存此方案,如果要保存,请单击没有.

doc合并相同的标头17

现在,工作表在新工作簿中与相同的行标题合并。

doc合并相同的标头18

合并具有相同页眉的多个工作表

安装后 Kutools for Excel,请执行以下操作:(立即免费下载Kutools for Excel!)

1。 点击 企业 > 结合 显示合并向导,并检查 将多个工作簿中的值合并并计算到一个工作表中。 看截图:
doc kutools结合5

2。 点击 下一个>>合并工作表-第2步,共3步 向导,然后执行以下操作:

doc kutools结合3
1)点击 地址 > 文件夹 添加工作簿,您可以将工作表从合并到 工作簿清单;
2)检查要合并工作表的工作簿名称,可以选择多个工作簿;
3)检查要合并在一起的工作表;
4)点击 doc选择 选择要合并的范围,如果范围位于每张纸的相同位置,则只需从一张纸中选择一个范围,然后单击 相同范围.

3.继续点击 下一个>>,然后选择要在合并范围内应用的功能,然后检查合并范围的标签。 看截图:
doc kutools结合6

4。 点击 完成,然后弹出一个对话框,要求您保存场景,单击 保存或单击 没有 不保存它。

然后将范围合并到新的工作簿中。

doc合并相同的标头12

的优点 Kutools for Excel 结合 功能是您可以将打开的工作簿或未打开的工作簿中的多个工作表合并为一个工作表或一个工作簿。

根据Excel中的相同值轻松合并/合并数据

假设您正在使用包含多个重复记录的工作表,现在您需要基于相同的值合并/合并行,并进行一些计算,例如总和,平均值,重复行的计数。 有了这个 高级组合行 of Kutools for Excel,您可以将相同的值/相同的数据或重复的行快速组合到适当的单元格中。  点击即可获得 30 天的全功能免费试用!
doc高级合并行
 
Kutools for Excel:拥有300多个便捷的Excel加载项,可以在30天内免费试用。

相关文章

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (19)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
When using the VBA code only two of my sheets are combining instead of the three active sheets. The headers are all the same and all start in cell A1. Would you have any idea what the issue is please?
This comment was minimized by the moderator on the site
Bonjour, est-ce possible de Fusionner et LIER Plusieurs Feuilles Avec Les Mêmes En-Têtes Dans Excel afin que les changements qui sont effectués dans les feuilles du classeur soient appliqués dans la nouvelle feuille "combinée"?
This comment was minimized by the moderator on the site
Hello, If you want to combine sheets which with the same sheet names, there is no built-in feature in Excel can help you. You can try Combine feature of Kutools for Excel, it provides an option that combine sheets with same names, for more details, you can visit this tutorial https://www.extendoffice.com/product/kutools-for-excel/excel-combine-sheets-of-same-name-into-one-worksheet.html. And Kutools for Excel supports 30-day free trial, you can download it to have a try. https://www.extendoffice.com/download/kutools-for-excel.html
This comment was minimized by the moderator on the site
Very helpful the code for combining multiple worksheets, it worked fine! Thank you!
This comment was minimized by the moderator on the site
what will be vba code for combining multiple sheets in workbook into one worksheet if row headers are the same ( not column headers)
This comment was minimized by the moderator on the site
I used VBA to copy all sheets to one, but how can I copy only select sheets instead of all of them?
This comment was minimized by the moderator on the site
Esta excelente la primera macro, pero no sabrias decirme por que solamente me combina 4 columnas?. Si mis hojas tienen un aproximado de 30 columnas.
This comment was minimized by the moderator on the site
Hello
I bought Kutools for Excel 19.00, by interest in the merge function, but doesn't work with my files and sheets, all have the same name (Workbook an sheets) but in the combination of : "Combine all same name worksheets into one worksheet" dosn't work (does nothing), inclusive don't saves the new workbook in the place that I select prior to execute de Finish button.
I followed the instructions one and another time, but the result is the same.
Some help?
This comment was minimized by the moderator on the site
Hi, Ezequiel Zavaleta, I am sorry for hear that. You can contact our Customer Service Manager through this: our team will solve your problems as soon as possible.
This comment was minimized by the moderator on the site
perfect, thank you
This comment was minimized by the moderator on the site
How can I combine only sheets with same header ignoring other sheets?
This comment was minimized by the moderator on the site
How do I merge only select worksheets in that workbook?
How can I run the Macro to refresh the data on a weekly basis without having to delete the "Combined" tab?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations