メインコンテンツへスキップ

ワークシートまたはワークブックをXNUMXつのワークシートにマージまたは統合するにはどうすればよいですか?

私たちの日常業務では、Excelで[コピーして貼り付け]コマンドを使用すると、データを分析するために数百枚のシートまたはブックをXNUMX枚のシートにマージするという問題が発生する場合があります。 このチュートリアルでは、この仕事をすばやく解決するためのヒントをいくつか紹介します。

ドキュメント結合1

クイックナビゲーション

アクティブなブックのすべてのシートをVBAを使用してXNUMXつのシートにマージする
数十枚のシートまたはワークブックをXNUMXつのワークシート/ワークブックにクリックでマージ
XNUMXつのテーブルをXNUMXつにマージし、クリックで列ごとに更新します
サンプルファイルをダウンロードする


アクティブなブックのすべてのシートをVBAを使用してXNUMXつのシートにマージする

このセクションでは、実行中にアクティブなブックのすべてのシートを収集するための新しいシートを作成するVBAコードを提供します。

1.すべてのシートを結合するワークブックをアクティブにしてからを押します + 開くキー アプリケーション向け Microsoft Visual Basic 窓。

2.ポップウィンドウで、をクリックします インセット > モジュール 新しいモジュールスクリプトを作成します。

3.以下のコードをコピーして、スクリプトに貼り付けます。

Sub Combine()
'UpdatebyExtendoffice
Dim J As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
For J = 2 To Sheets.Count
Sheets(J).Activate
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
Next
End Sub
ドキュメント結合2

4。 押す F5 キーを押すと、シート全体のすべてのデータが、すべてのシートの前面に配置されるCombinedという名前の新しいシートにマージされます。


移動する

あなたは昇給と家族と一緒に多くの時間を過ごしたいですか?

Officeタブは、現在作業中のMicrosoft Officeで効率を50%向上させます

信じられないほど、XNUMXつ以上のドキュメントで作業する方が、XNUMXつで作業するよりも簡単で高速です。

よく知られているブラウザと比較して、Officeタブのタブ付きツールはより強力で効率的です。

毎日何百ものマウスクリックとキーボード入力を減らして、今すぐマウスの手に別れを告げましょう。

通常、複数のドキュメントで作業する場合は、Officeタブを使用すると時間を大幅に節約できます。

30・XNUMX日無料お試し、クレジットカードは必要ありません。

続きを読む今すぐダウンロード


数十枚のシートまたはワークブックをXNUMXつのワークシート/ワークブックにクリックでマージ

VBAを使用すると、アクティブなブック内のシートのみを組み合わせることができますが、ブック間でシートをシートまたはブックにマージするにはどうすればよいですか?

ブック全体のシートをXNUMXつのシートにマージします
ドキュメント結合18

ブック全体のシートをXNUMXつのブックにマージします
ドキュメント結合3

この仕事を解決し、シートの組み合わせに関する他の要件を満たすために、 組み合わせる 関数は、次のXNUMXつの組み合わせシナリオで開発されました。

  • 複数のシートまたはワークブックをXNUMXつのシートに結合します
  • 複数のシートまたはワークブックをXNUMXつのワークブックに結合する
  • 同じ名前のシートをXNUMXつのシートに結合します
  • シートまたはワークブック全体の値をXNUMXつのシートに統合します

次に、XNUMX番目のオプションをインスタンスとして使用します。

複数のシートまたはワークブックをXNUMXつのワークブックに結合する

無料インストール Kutools for Excel、以下のようにしてください:

1. Excelをアクティブにして、をクリックします クツールズプラス > 組み合わせる、ダイアログがポップアップ表示され、結合するワークブックを閉じる必要があることを通知します。 クリック OK 続行します。
ドキュメント結合4
ドキュメント結合5

2。 の中に ワークシートを組み合わせるステップ1 ダイアログ、チェック ワークブックの複数のワークシートをXNUMXつのワークブックに結合します オプション。 クリック Next ウィザードの次のステップに進みます。
ドキュメント結合6

3。 クリック Add > File or フォルダ 結合するワークブックをに追加するには ワークブックリスト ペインで、名前をチェックすることにより、どのワークシートを結合するかを指定できます。 ワークシートリスト ペイン。 クリック Next ウィザードの最後のステップに進みます。
ドキュメント結合7

4.このステップでは、必要に応じて設定を指定します。 次に、をクリックします 終了.
ドキュメント結合8

5.結合されたブックを配置するフォルダーを選択するためのウィンドウがポップアップし、[ Save.
ドキュメント結合9

これで、ワークブックがXNUMXつのワークブックにマージされました。 また、すべてのシートの前面に、Kutools for Excelという名前のマスターシートも作成され、シートに関する情報と各シートのリンクが一覧表示されます。
ドキュメント結合10

デモ:シート/ワークブックをXNUMXつのシートまたはワークブックに結合します

Kutools for Excel:200+便利な便利なツール。Excelの複雑なタスクを数回クリックするだけで簡単に行えます。

今すぐマウスの手と頸椎症に別れを告げる

Kutools for Excelソルブの300の高度なツール 80% 数秒で Excel タスクを実行し、何千ものマウス クリックから解放されます。

1500 の作業シナリオに簡単に対処できるため、ソリューションの検索に時間を無駄にする必要がなく、人生を楽しむために十分な時間を確保できます。

毎日 80 人以上の非常に有能な従業員 (もちろんあなたも含む) の生産性が 110000% 向上します。

痛みを伴うフォーミュラやVBAに悩まされることはもうありません。脳を休ませ、楽しい働きをしてください。

フル機能を備えた 30 日間の無料トライアル、理由のない 30 日間の返金。

より良い体はより良い生活を創造します。


XNUMXつのテーブルをXNUMXつにマージし、クリックで列ごとに更新します

XNUMXつのテーブルをXNUMXつにマージし、以下のスクリーンショットに示すように列に基づいてデータを更新する場合は、 テーブルマージ の有用性 Kutools for Excel.
ドキュメント結合11

Kutools for Excel:複雑なタスクをExcelで数回クリックするだけで簡素化する、200を超える便利なExcelアドイン

無料インストール Kutools for Excel、以下のようにしてください:

1。 クリック クツールズプラス > テーブルマージ 有効にする テーブルマージ ウィザードを起動します。
ドキュメント結合12

2.ウィザードのステップ1で、メインテーブルとルックアップテーブルの範囲を個別に選択する必要があります。 次に、をクリックします Next.
ドキュメント結合13

3.ベースのメインテーブルのデータを更新するキー列をチェックします。 クリック Next.
ドキュメント結合14

4.次に、ルックアップテーブルに基づいてデータを更新するメインテーブルの列を確認します。 クリック Next.
ドキュメント結合15

5.ウィザードのステップ4で、ルックアップテーブルからメインテーブルに追加する列を確認します。 クリック Next.
ドキュメント結合16

6.ウィザードの最後のステップで、必要に応じて設定オプションを指定します。 次に、をクリックします 終了.
ドキュメント結合17

これで、メインテーブルのデータが更新され、ルックアップテーブルに基づいて新しいデータが追加されました。

デモ:シート/ワークブックをXNUMXつのシートまたはワークブックに結合します

Kutools for Excel:200+便利な便利なツール。Excelの複雑なタスクを数回クリックするだけで簡単に行えます。


サンプルファイルのダウンロード

サンプル


推奨される生産性ツール

Officeタブ-MicrosoftOffice2019-2003およびOffice365でのドキュメントのタブブラウジング、編集、管理


オフィスタブ

Excel 2019-2007を高速化するためのプロフェッショナルアドイン、時間タスクを秒に短縮

このアドインには数十の専門家グループが含まれており、300以上のオプションにより、Excelでの日常のタスクのほとんどが自動化され、生産性が少なくとも50%向上します。 ワンクリックオプトンのグループやバッチ変換など。
今こそ、Kutools forExcelでスピードアップするチャンスです!


Comments (168)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi, I have a system that generates an excel file everyday. The daily file name is of format "<filename-12282021>". The 12282021 is the timestamp and it changes everyday creating a new excel file each day. I want to create a Master Workbook and then append the contents of the daily excel file into that master workbook. How can I automate it so it happens by itself everyday and the master file is update with contents of the daily file.   Thank you.
This comment was minimized by the moderator on the site
Hi rd2022, sorry that I have no idea to solve your problem so far. You can go to our forum https://www.extendoffice.com/forum/excel.html to leave this message, maybe some users have the same problem and has been solved.
This comment was minimized by the moderator on the site
In combining shhets I want to add one extra column in combined sheet as ShhetName
Can you suggest ?
This comment was minimized by the moderator on the site
The Combine function of Kutools for Excel can help you to insert sheet name in a new row of each combined range in the combined sheet by checking First row of each range (new row) in Insert worksheet information section in the last step of the Combine.
This comment was minimized by the moderator on the site
Hi - this function works well except my file has more than 900 sheets, and when I change the maximum number of rows (Loc 16, "A65536") to a higher number, the macro doesn't work. Is there a way to increase the number of rows that can be shown on the combine sheet?
This comment was minimized by the moderator on the site
The VBA code works fine but I want the data to be merged horizontally(side by side).
Hope you can help.
This comment was minimized by the moderator on the site
Hi,


Great Code and for the most part it works fantastically well.


Could I suggest creating a written tutorial for each line of code. I'd love to be able to play around with it to suit my Company's needs.

In the meantime however could you talk me through problems that would hinder this code from copying all data from each Sheet? I've noticed some sheets in my workbook aren't being copied at all.

To give you some context I'm dealing with roughly 330 sheets and they hold from 50 to 500 lines in each.


looking forward to hearing from you.
This comment was minimized by the moderator on the site
Hi, Daniel, I do not understand your question as you describe it not clearly, but if you have the Combine function in Excel, it can solve most of your question about combining sheets.
This comment was minimized by the moderator on the site
Hi,

Is it possible to only copy a particular range of cells for example A:4:FU38 from each sheet?


Also in the Combined sheet where the data is copied to, can the tab names from where the data is copied included in column A to enable lookups or to pivot the data?


Finally, can i specify the list of worksheets from which to copy the data across or maybe i can specify something like copy all worksheets to the left of a particular worksheet in the file.


Thanks in advance for your help
This comment was minimized by the moderator on the site
Hi, HS, you mean to combine same ranges from sheets into one sheet, it that right? If so, this article may help you: https://www.extendoffice.com/documents/excel/2754-excel-combine-ranges-from-different-worksheets-into-one.html#a3
This comment was minimized by the moderator on the site
This VBA code is an absolute lifesaver. Thank you!!
This comment was minimized by the moderator on the site
Hi. This code works well but I have the same problem as adj. The 1st row form each tab doesn't appear in the combined tab - except he first tab. Thanks
This comment was minimized by the moderator on the site
Just delete "Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select" from the code.

If you want to merge all rows from all worksheets, just use the code:

Sub Combine()

'UpdatebyExtendoffice

Dim J As Integer

On Error Resume Next

Sheets(1).Select

Worksheets.Add

Sheets(1).Name = "Combined"

Sheets(2).Activate

Range("A1").EntireRow.Select

Selection.Copy Destination:=Sheets(1).Range("A1")

For J = 2 To Sheets.Count

Sheets(J).Activate

Range("A1").Select

Selection.CurrentRegion.Select

Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)

Next

End Sub
This comment was minimized by the moderator on the site
Yes, the code only can keep first row of the first tab, because it is used to consolidate, if you want to keep all contents of each sheet, you can try Combine utility of Kutools for Excel, it is free fior 60 days
This comment was minimized by the moderator on the site
i had a problem when I try to combine all same name worksheet to one worksheet, it works but some value are missing. so what should i do?
This comment was minimized by the moderator on the site
Hello, elok, did the problem appear while you applying Combine function? If so, please go to contact us to describe the problem with more details, our support will handle the problem for you.
This comment was minimized by the moderator on the site
Thanks that macro saved my day. I had over 40 sheets of data to combine into one and although my computer bogged for a minute or two, it completed without issue. The only modification I made was I tweaked the macro to start with A2 instead of A1 since A1 was my column headers.
This comment was minimized by the moderator on the site
Thanks for your support, Andrew, I am glad that the macro can help you.
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