跳到主要內容

如何在Excel中合併具有相同標題的多個工作表?

例如,您在不同的工作表中具有一些具有相同標題的數據,如下面的屏幕截圖所示,現在您的工作是將這些工作表合併為一個工作表。 本教程沒有一個一個地複制和粘貼它們,而是為您介紹了處理此工作的更好方法。

doc合併相同的標頭1
doc合併相同的標頭2
doc合併相同的標頭3

通過VBA合併具有相同標題的工作表

通過合併功能合併具有相同標題的Excel工作表

通過Kutools for Excel合併或合併具有相同標題的Excel工作表 好主意3


箭頭藍色右氣泡 通過VBA合併具有相同標題的工作表

如果您只想合併具有相同標題的圖紙而無需任何計算,則可以應用VBA代碼來解決。

1.激活要合併圖紙的工作簿,然後按 Alt + F11鍵 打開鑰匙 Microsoft Visual Basic for Applications 窗口。

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工作表

如果在某些情況下只想合併具有相同標題的數據,而在其他情況下又想合併數據並合併它們,是否有任何技巧可以解決這兩個任務? 這裡我介紹 Excel的Kutools很強大 結合 功能為你。

合併具有相同標題的Excel工作表

合併具有相同頁眉的多個工作表

Excel的Kutools, 與以上 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

的優點 Excel的Kutools 結合 功能是您可以將打開的工作簿或未打開的工作簿中的多個工作表合併為一個工作表或一個工作簿。

根據Excel中的相同值輕鬆合併/合併數據

假設您正在使用包含多個重複記錄的工作表,現在您需要根據相同的值合併/合併行,並進行一些計算,例如總和,平均值,重複行的計數。 有了這個 高級合併行 of Excel的Kutools,您可以將相同的值/相同的數據或重複的行快速組合到適當的單元格中。  點擊即可獲得 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選項卡為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