ไปยังเนื้อหาหลัก

วิธีการรวมหรือรวมแผ่นงานหรือสมุดงานไว้ในแผ่นงานเดียว

ในการทำงานประจำวันของเราเราอาจพบปัญหาที่รวมแผ่นงานหรือสมุดงานหลายร้อยแผ่นไว้ในแผ่นงานเดียวสำหรับการวิเคราะห์ข้อมูลซึ่งต้องใช้เวลามากหากคุณใช้คำสั่งคัดลอกและวางใน Excel ในบทช่วยสอนนี้ฉันจะให้คำแนะนำในการแก้ปัญหานี้อย่างรวดเร็ว

doc รวม 1

การนำทางอย่างรวดเร็ว

การรวมแผ่นงานทั้งหมดของสมุดงานที่ใช้งานอยู่เป็นแผ่นเดียวด้วย VBA
การรวมแผ่นงานหรือสมุดงานจำนวนมากไว้ในแผ่นงาน / สมุดงานเดียวด้วยการคลิก
การรวมตารางสองตารางเข้าเป็นหนึ่งเดียวและอัปเดตตามคอลัมน์ด้วยการคลิก
ดาวน์โหลดไฟล์ตัวอย่าง


การรวมแผ่นงานทั้งหมดของสมุดงานที่ใช้งานอยู่เป็นแผ่นเดียวด้วย VBA

ในส่วนนี้ฉันให้รหัส VBA ซึ่งจะสร้างแผ่นงานใหม่เพื่อรวบรวมแผ่นงานทั้งหมดของสมุดงานที่ใช้งานอยู่ในขณะที่คุณเรียกใช้

1. เปิดใช้งานสมุดงานที่คุณต้องการรวมแผ่นงานทั้งหมดจากนั้นกด + กุญแจเพื่อเปิด Microsoft Visual Basic สำหรับแอปพลิเคชัน หน้าต่าง

2. ในหน้าต่าง popping คลิก สิ่งที่ใส่เข้าไป > โมดูล เพื่อสร้างสคริปต์โมดูลใหม่

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
doc รวม 2

4 กด F5 จากนั้นข้อมูลทั้งหมดในแผ่นงานจะถูกรวมเข้ากับแผ่นงานใหม่ที่ชื่อว่า Combined ซึ่งจะอยู่ด้านหน้าของแผ่นงานทั้งหมด


ot ย้าย

คุณต้องการเพิ่มค่าจ้างและมีเวลามากพอกับครอบครัวหรือไม่?

แท็บ Office ช่วยเพิ่มประสิทธิภาพของคุณได้ 50% ใน Microsoft Office กำลังทำงานอยู่ในขณะนี้

ไม่น่าเชื่อการทำงานกับเอกสารสองชุดขึ้นไปนั้นง่ายและรวดเร็วกว่าการทำงานในเอกสารเดียว

เมื่อเปรียบเทียบกับเบราว์เซอร์ที่รู้จักกันดีเครื่องมือแบบแท็บใน Office Tab มีประสิทธิภาพและมีประสิทธิภาพมากกว่า

ลดจำนวนการคลิกเมาส์และการพิมพ์แป้นพิมพ์ทุกวันสำหรับคุณบอกลามือเมาส์ได้เลย

หากคุณมักจะทำงานกับเอกสารหลายชุด Office Tab จะช่วยประหยัดเวลาได้อย่างดีเยี่ยม

30วันทดลองใช้ฟรีไม่ต้องใช้บัตรเครดิต

อ่านเพิ่มเติมดาวน์โหลดฟรีเดี๋ยวนี้


การรวมแผ่นงานหรือสมุดงานจำนวนมากไว้ในแผ่นงาน / สมุดงานเดียวด้วยการคลิก

ด้วย VBA คุณสามารถรวมแผ่นงานในสมุดงานที่ใช้งานอยู่เท่านั้น แต่คุณจะรวมแผ่นงานระหว่างสมุดงานกับแผ่นงานหรือสมุดงานได้อย่างไร

รวมแผ่นงานข้ามสมุดงานเป็นแผ่นเดียว
doc รวม 18

ผสานแผ่นงานข้ามสมุดงานเป็นสมุดงานเดียว
doc รวม 3

สำหรับการแก้ไขงานนี้และเป็นไปตามข้อกำหนดอื่น ๆ ในการรวมแผ่นงานไฟล์ รวมกัน ฟังก์ชันได้รับการพัฒนาโดยมีสถานการณ์รวมกันสี่แบบ:

  • รวมแผ่นงานหรือสมุดงานหลายแผ่นเป็นแผ่นเดียว
  • รวมแผ่นงานหรือสมุดงานหลายแผ่นไว้ในสมุดงานเดียว
  • รวมแผ่นงานชื่อเดียวกันเป็นแผ่นเดียว
  • รวมค่าระหว่างแผ่นงานหรือสมุดงานไว้ในแผ่นงานเดียว

ที่นี่ใช้ตัวเลือกที่สองเป็นอินสแตนซ์:

รวมแผ่นงานหรือสมุดงานหลายแผ่นไว้ในสมุดงานเดียว

หลังจาก ติดตั้งฟรี Kutools สำหรับ Excel โปรดทำดังนี้:

1. เปิดใช้งาน Excel คลิก Kutools พลัส > รวมกันกล่องโต้ตอบจะปรากฏขึ้นเพื่อเตือนคุณว่าต้องปิดสมุดงานที่คุณต้องการรวม คลิก OK เพื่อดำเนินการต่อ
doc รวม 4
doc รวม 5

2 ใน รวมแผ่นงานขั้นตอนที่ 1 โต้ตอบตรวจสอบ รวมแผ่นงานหลายแผ่นจากสมุดงานไว้ในสมุดงานเดียว ตัวเลือก คลิก ถัดไป เพื่อไปยังขั้นตอนต่อไปของวิซาร์ด
doc รวม 6

3 คลิก เพิ่ม > เนื้อไม่มีมัน or โฟลเดอร์ เพื่อเพิ่มเวิร์กบุ๊กที่คุณต้องการรวมเข้ากับไฟล์ รายการสมุดงาน บานหน้าต่างจากนั้นคุณสามารถระบุได้ว่าจะรวมแผ่นงานใดเข้าด้วยกันโดยการตรวจสอบชื่อใน รายการแผ่นงาน บานหน้าต่าง คลิก ถัดไป เพื่อไปยังขั้นตอนสุดท้ายของวิซาร์ด
doc รวม 7

4. ในขั้นตอนนี้ระบุการตั้งค่าตามที่คุณต้องการ จากนั้นคลิก เสร็จสิ้น.
doc รวม 8

5. หน้าต่างจะปรากฏขึ้นเพื่อให้คุณเลือกโฟลเดอร์เพื่อวางสมุดงานรวมจากนั้นคลิก ลด.
doc รวม 9

ตอนนี้เวิร์กบุ๊กรวมเป็นสมุดงานเดียวแล้ว และที่ด้านหน้าของแผ่นงานทั้งหมดจะมีการสร้างแผ่นงานต้นแบบชื่อ Kutools for Excel ซึ่งจะแสดงข้อมูลบางอย่างเกี่ยวกับแผ่นงานและลิงก์สำหรับแต่ละแผ่นงาน
doc รวม 10

การสาธิต: รวมแผ่นงาน / สมุดงานไว้ในแผ่นงานหรือสมุดงานเดียว

Kutools for Excel: 200 + เครื่องมือที่มีประโยชน์ซึ่งช่วยลดความซับซ้อนของงานที่ซับซ้อนใน Excel ได้ในไม่กี่คลิก

บอกลามือเมาส์และกระดูกคอได้เลย

300 เครื่องมือขั้นสูงของ Kutools for Excel แก้ปัญหา ลด 80% งาน Excel ในไม่กี่วินาที ดึงคุณออกจากการคลิกเมาส์นับพัน

จัดการกับสถานการณ์การทำงานกว่า 1500 สถานการณ์ได้อย่างง่ายดาย ไม่ต้องเสียเวลาค้นหาวิธีแก้ปัญหา มีเวลามากพอที่จะสนุกกับชีวิตของคุณ

ปรับปรุงประสิทธิภาพการทำงาน 80% ให้กับผู้คนที่มีประสิทธิภาพสูงกว่า 110000 คนทุกวัน รวมถึงคุณด้วย

ไม่ต้องทรมานกับสูตรเจ็บปวดและ VBA อีกต่อไปให้สมองของคุณได้พักผ่อนและมีอารมณ์ในการทำงานที่สนุกสนาน

ทดลองใช้งานฟรี 30 วันพร้อมฟีเจอร์ครบครัน คืนเงิน 30 วันโดยไม่มีเหตุผล

ร่างกายที่ดีขึ้นสร้างชีวิตที่ดีขึ้น


การรวมตารางสองตารางเข้าเป็นหนึ่งเดียวและอัปเดตตามคอลัมน์ด้วยการคลิก

หากคุณต้องการรวมสองตารางเป็นหนึ่งเดียวและอัปเดตข้อมูลตามคอลัมน์ตามภาพด้านล่างนี้คุณสามารถลองใช้ไฟล์ ตารางผสาน ประโยชน์ของ Kutools สำหรับ Excel.
doc รวม 11

Kutools for Excel: Add-in ของ Excel ที่มีประโยชน์มากกว่า 200 รายการเพื่อลดความซับซ้อนของงานที่ซับซ้อนลงในไม่กี่คลิกใน Excel

หลังจาก ติดตั้งฟรี Kutools สำหรับ Excel โปรดทำดังนี้:

1 คลิก Kutools พลัส > ตารางผสาน การเปิดใช้งาน ตารางผสาน ตัวช่วยสร้าง
doc รวม 12

2. ในขั้นตอนที่ 1 ของวิซาร์ดคุณต้องเลือกตารางหลักและช่วงตารางการค้นหาแยกกัน จากนั้นคลิก ถัดไป.
doc รวม 13

3. ตรวจสอบคอลัมน์หลักที่คุณต้องการอัปเดตข้อมูลในตารางหลักตาม คลิก ถัดไป.
doc รวม 14

4. จากนั้นตรวจสอบคอลัมน์ในตารางหลักที่คุณต้องการอัปเดตข้อมูลตามตารางการค้นหา คลิก ถัดไป.
doc รวม 15

5. ในขั้นตอนที่ 4 ของวิซาร์ดตรวจสอบคอลัมน์ที่คุณต้องการเพิ่มจากตารางการค้นหาไปยังตารางหลัก คลิก ถัดไป.
doc รวม 16

6. ในขั้นตอนสุดท้ายของวิซาร์ดให้ระบุตัวเลือกการตั้งค่าตามที่คุณต้องการ จากนั้นคลิก เสร็จสิ้น.
doc รวม 17

ตอนนี้ตารางหลักได้รับการอัปเดตข้อมูลและเพิ่มข้อมูลใหม่ตามตารางการค้นหา

การสาธิต: รวมแผ่นงาน / สมุดงานไว้ในแผ่นงานหรือสมุดงานเดียว

Kutools for Excel: 200 + เครื่องมือที่มีประโยชน์ซึ่งช่วยลดความซับซ้อนของงานที่ซับซ้อนใน Excel ได้ในไม่กี่คลิก


ดาวน์โหลดไฟล์ตัวอย่าง

ตัวอย่าง


เครื่องมือเพิ่มประสิทธิภาพที่แนะนำ

แท็บ Office - การเรียกดูแบบแท็บการแก้ไขการจัดการเอกสารใน Microsoft Office 2019-2003 และ Office 365


แท็บสำนักงาน

Add-in ระดับมืออาชีพสำหรับการเร่ง Excel 2019-2007 ลดงานชั่วโมงเป็นวินาที

Add-in นี้ประกอบด้วยกลุ่มวิชาชีพหลายสิบกลุ่มโดยมีตัวเลือกมากกว่า 300 รายการจะทำให้งานประจำวันส่วนใหญ่ของคุณเป็นไปโดยอัตโนมัติและเพิ่มประสิทธิภาพการทำงานของคุณอย่างน้อย 50% เช่นกลุ่มของตัวเลือกในคลิกเดียวและการแปลงเป็นกลุ่ม
ตอนนี้เป็นโอกาสของคุณที่จะเร่งความเร็วตัวเองด้วย Kutools for Excel!


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