انتقل إلى المحتوى الرئيسي

كيفية دمج عدة مصنفات في مصنف رئيسي واحد في Excel؟

هل سبق لك أن علقت عندما تضطر إلى دمج العديد من المصنفات في مصنف رئيسي في Excel؟ أفظع شيء هو أن المصنفات التي تحتاج إلى دمجها تحتوي على أوراق عمل متعددة. وكيف يمكن دمج أوراق العمل المحددة فقط من مصنفات متعددة في مصنف واحد؟ يوضح هذا البرنامج التعليمي عدة طرق مفيدة لمساعدتك على حل المشكلة بخطوات.


ادمج عدة مصنفات في مصنف واحد باستخدام وظيفة النقل أو النسخ

إذا كان هناك بعض المصنفين فقط بحاجة إلى الدمج ، فيمكنك استخدام الأمر نقل أو نسخ لنقل أوراق العمل يدويًا أو نسخها من المصنف الأصلي إلى المصنف الرئيسي.

1. افتح المصنفات التي ستقوم بدمجها في مصنف رئيسي.

2. حدد أوراق العمل في المصنف الأصلي الذي ستنقله أو تنسخه إلى المصنف الرئيسي.

الملاحظات:

1). يمكنك تحديد عدة أوراق عمل غير متجاورة مع الاستمرار في الضغط على CTRL المفتاح والنقر فوق علامات تبويب الأوراق واحدة تلو الأخرى.

2). لاختيار عدة أوراق عمل متجاورة ، يرجى النقر فوق علامة تبويب الورقة الأولى ، مع الاستمرار في الضغط على تغير ، ثم انقر فوق علامة تبويب الورقة الأخيرة لتحديدها جميعًا.

3). يمكنك النقر بزر الماوس الأيمن فوق أي علامة تبويب ورقة ، والنقر فوق حدد كافة الأوراق من قائمة السياق لتحديد جميع أوراق العمل في المصنف في نفس الوقت.

3. بعد تحديد أوراق العمل المطلوبة ، انقر بزر الماوس الأيمن فوق علامة تبويب الورقة ، ثم انقر فوق نقل أو نسخ من قائمة السياق. انظر لقطة الشاشة:

4. ثم نقل أو نسخ الحوار المنبثقة ، في للحجز القائمة المنسدلة ، حدد المصنف الرئيسي الذي ستقوم بنقل أوراق العمل إليه أو نسخ أوراق العمل إليه. حدد نقل لإنهاء ملف قبل الورقة مربع ، تحقق من قم بإنشاء نسخة مربع ، وأخيراً انقر فوق OK .

ثم يمكنك مشاهدة أوراق العمل في مصنفين مدمجين في مصنف واحد. يرجى تكرار الخطوات المذكورة أعلاه لنقل أوراق العمل من المصنفات الأخرى إلى المصنف الرئيسي.


ادمج عدة مصنفات أو أوراق محددة من المصنفات في مصنف رئيسي باستخدام VBA

إذا كان هناك العديد من المصنفات التي يجب دمجها في واحدة ، فيمكنك تطبيق أكواد VBA التالية لتحقيق ذلك بسرعة. الرجاء القيام بما يلي.

1. ضع كل المصنفات التي تريد دمجها في واحد ضمن نفس الدليل.

2. قم بتشغيل ملف Excel (سيكون هذا المصنف هو المصنف الرئيسي).

3. اضغط على قديم + F11 مفاتيح لفتح Microsoft Visual Basic للتطبيقات نافذة او شباك. في ال Microsoft Visual Basic للتطبيقات الإطار، انقر فوق إدراج > وحدة، ثم انسخ رمز VBA أدناه في نافذة الوحدة النمطية.

كود فبا 1: دمج عدة مصنفات Excel في واحد

Sub GetSheets()
'Updated by Extendoffice 2019/2/20
Path = "C:\Users\dt\Desktop\dt kte\"
Filename = Dir(Path & "*.xlsx")
  Do While Filename <> ""
  Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
     For Each Sheet In ActiveWorkbook.Sheets
     Sheet.Copy After:=ThisWorkbook.Sheets(1)
  Next Sheet
     Workbooks(Filename).Close
     Filename = Dir()
  Loop
End Sub
	

الملاحظات:

1. سيحتفظ رمز VBA أعلاه بأسماء أوراق المصنفات الأصلية بعد الدمج.

2. إذا كنت تريد التمييز بين أوراق العمل الموجودة في المصنف الرئيسي والتي جاءت من المكان بعد الدمج ، فيرجى تطبيق رمز VBA أدناه 2.

3. إذا كنت تريد فقط دمج أوراق عمل محددة من المصنفات في مصنف رئيسي ، فيمكن أن يساعدك رمز VBA 3 أدناه.

في رموز VBA ، "ج: \ المستخدمون \ DT168 \ سطح المكتب \ KTE \"هو مسار المجلد. في رمز VBA 3 ، "ورقة 1 ، ورقة 3"هي أوراق العمل المحددة للمصنفات التي ستجمعها في مصنف رئيسي. يمكنك تغييرها بناءً على احتياجاتك.

كود فبا 2: دمج المصنفات في واحد (سيتم تسمية كل ورقة عمل ببادئة اسم الملف الأصلي الخاص بها):

Sub MergeWorkbooks()
'Updated by Extendoffice 2019/2/20
Dim xStrPath As String
Dim xStrFName As String
Dim xWS As Worksheet
Dim xMWS As Worksheet
Dim xTWB As Workbook
Dim xStrAWBName As String
On Error Resume Next
xStrPath = "C:\Users\DT168\Desktop\KTE\"
xStrFName = Dir(xStrPath & "*.xlsx")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set xTWB = ThisWorkbook
Do While Len(xStrFName) > 0
    Workbooks.Open Filename:=xStrPath & xStrFName, ReadOnly:=True
    xStrAWBName = ActiveWorkbook.Name
    For Each xWS In ActiveWorkbook.Sheets
    xWS.Copy After:=xTWB.Sheets(xTWB.Sheets.Count)
    Set xMWS = xTWB.Sheets(xTWB.Sheets.Count)
    xMWS.Name = xStrAWBName & "(" & xMWS.Name & ")"
    Next xWS
    Workbooks(xStrAWBName).Close
    xStrFName = Dir()
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

كود فبا 3: دمج أوراق عمل محددة من المصنفات في مصنف رئيسي:

Sub MergeSheets2()
'Updated by Extendoffice 2019/2/20
Dim xStrPath As String
Dim xStrFName As String
Dim xWS As Worksheet
Dim xMWS As Worksheet
Dim xTWB As Workbook
Dim xStrAWBName As String
Dim xI As Integer
On Error Resume Next

xStrPath = " C:\Users\DT168\Desktop\KTE\"
xStrName = "Sheet1,Sheet3"

xArr = Split(xStrName, ",")

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set xTWB = ThisWorkbook
xStrFName = Dir(xStrPath & "*.xlsx")
Do While Len(xStrFName) > 0
Workbooks.Open Filename:=xStrPath & xStrFName, ReadOnly:=True
xStrAWBName = ActiveWorkbook.Name
For Each xWS In ActiveWorkbook.Sheets
For xI = 0 To UBound(xArr)
If xWS.Name = xArr(xI) Then
xWS.Copy After:=xTWB.Sheets(xTWB.Sheets.count)
Set xMWS = xTWB.Sheets(xTWB.Sheets.count)
xMWS.Name = xStrAWBName & "(" & xArr(xI) & ")"
Exit For
End If
Next xI
Next xWS
Workbooks(xStrAWBName).Close
xStrFName = Dir()
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True

End Sub

4. اضغط على F5 مفتاح لتشغيل الكود. ثم يتم دمج جميع أوراق العمل أو أوراق العمل المحددة للمصنفات الموجودة في مجلد معين في مصنف رئيسي مرة واحدة.


يمكنك بسهولة الجمع بين مصنفات متعددة أو أوراق محددة من المصنفات في مصنف واحد

لحسن الحظ، و دمج المصنف فائدة كوتولس ل إكسيل يسهل دمج عدة مصنفات في مصنف واحد. دعونا نرى كيفية جعل هذه الوظيفة تعمل في الجمع بين مصنفات متعددة.

قبل التطبيق كوتولس ل إكسيلالرجاء قم بتنزيله وتثبيته أولاً.

1. قم بإنشاء مصنف جديد وانقر فوق كوتولس بلس > دمج. ثم ينبثق مربع حوار لتذكيرك بضرورة حفظ جميع المصنفات المدمجة ولا يمكن تطبيق الميزة على المصنفات المحمية ، يرجى النقر فوق OK .

2. في ال اجمع أوراق العمل المعالج ، حدد اجمع أوراق عمل متعددة من مصنفات في مصنف واحد الخيار ، ثم انقر فوق التالى زر. انظر لقطة الشاشة:

3. في ال اجمع أوراق العمل - الخطوة 2 من 3 مربع الحوار، انقر فوق أضف > قم بتقديم or مجلد لإضافة ملفات Excel سوف تدمج في ملف واحد. بعد إضافة ملفات Excel ، انقر فوق نهاية زر واختر مجلدًا لحفظ المصنف الرئيسي. انظر لقطة الشاشة:

الآن تم دمج كافة المصنفات في واحد.

مقارنة بالطريقتين المذكورتين أعلاه ، كوتولس ل إكسيل لديه المزايا التالية:

  • 1) يتم سرد كافة المصنفات وأوراق العمل في مربع الحوار ؛
  • 2) بالنسبة لأوراق العمل التي تريد استبعادها من الدمج ، ما عليك سوى إلغاء تحديدها ؛
  • 3) يتم استبعاد أوراق العمل الفارغة تلقائيًا ؛
  • 4) سيتم إضافة اسم الملف الأصلي كبادئة لاسم الورقة بعد الدمج ؛
  • لمزيد من وظائف هذه الميزة ، الرجاء زيارة هنا.

  إذا كنت ترغب في الحصول على نسخة تجريبية مجانية (30 يومًا) من هذه الأداة المساعدة ، الرجاء الضغط لتنزيلهثم انتقل لتطبيق العملية حسب الخطوات المذكورة أعلاه.


كوتولس ل Excel - يساعدك دائمًا على إنهاء العمل قبل الوقت ، ولديك المزيد من الوقت للاستمتاع بالحياة
هل تجد نفسك غالبًا تلعب دورًا في اللحاق بالعمل ، وقلة الوقت الذي تقضيه لنفسك وعائلتك؟  كوتولس ل إكسيل يمكن أن تساعدك على التعامل معها 80% برنامج Excel يعمل على حل الألغاز وتحسين كفاءة العمل بنسبة 80٪ ، مما يمنحك مزيدًا من الوقت لرعاية الأسرة والاستمتاع بالحياة.
300 أداة متقدمة لسيناريوهات عمل 1500 ، اجعل عملك أسهل بكثير من أي وقت مضى.
لم تعد بحاجة إلى حفظ الصيغ ورموز VBA ، امنح عقلك قسطًا من الراحة من الآن فصاعدًا.
يمكن إجراء العمليات المعقدة والمتكررة لمرة واحدة في ثوانٍ.
قلل الآلاف من عمليات لوحة المفاتيح والماوس كل يوم ، وداعًا للأمراض المهنية الآن.
كن خبيرًا في برنامج Excel في 3 دقائق ، ومساعدتك في الحصول على التقدير بسرعة والحصول على ترقية في الراتب.
110,000 شخص ذو كفاءة عالية و 300 + اختيار شركة ذات شهرة عالمية.
اجعل 39.0 دولارًا تساوي أكثر من 4000.0 دولارًا لتدريب الآخرين.
تجربة مجانية كاملة الميزات لمدة 30 يومًا. ضمان استرداد الأموال لمدة 60 يومًا بدون سبب.

Comments (146)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have one workbook with 100+ sheets, I want to move all 100+ sheets into another workbook in a single sheet.
This comment was minimized by the moderator on the site
I had to read throught the comments to find suggestions that worked for my application of the VBA CODE 2, but I managed to get it to work doing the following things:
1. make sure to change "C:\Users\DT168\Desktop\KTE\" to your own directory to wherever you have your files are located. don't forget the extra "\" at the end!2. my spreadsheets were extension ".xls", so I deleted the extra "x" in this line, like so: xStrFName = Dir(xStrPath & "*.xlsx")3. I placed all my spreadsheets in a single folder, and only those files were the contents of that folder, the target macro enabled spreadsheet where this vba was running from was saved outside of this folder (hopefully this makes sense).
one thing that I didn't want to mess with though is I only needed to merge the 1st tab of each spreadsheet, but I didn't want to mess with the code so if each workbook you want to merge into one has multiple tabs, this code will grab all of the tabs on each workbook and place them in your target spreadsheet, I had to manually delete all the tabs I didn't want.
if the author of this vba could reply to me, how do you change the code to just copy the 1st tab as opposed to all the tabs?
thank you!
This comment was minimized by the moderator on the site
hi I want a change. If the the sheet name is same then the data should be appended in the same name sheet rather than adding a sheet. for example if i have 10 files with jan, feb, mar same sheetnames. then result should be 1 file having jan, feb, mar only 3 sheets with the data of all 10 files. thanks
This comment was minimized by the moderator on the site
Good morning,

Basically I have to copy the values of another file example c: \ test.xlsx (sheet name "date"):

I have to copy the values from A2: T20


And I have to paste in another Extract.xlsx file on the “Extracts” folder on A2.


PLEASE NOTE: You must run vba when opening the file.
This comment was minimized by the moderator on the site
Hello! I need to merge multiple files into one, that are password protected. All source files use the same password. What changes are needed to the first VBA script to merge the files without having to enter the password each time?
This comment was minimized by the moderator on the site
Hello any one can help me, I want to combine sheet 2 only from 5 different sheet, can you script for me.
This comment was minimized by the moderator on the site
you can use Array function to copy the multiple sheets to combine in one file
Sheets(Array("Sheet1","Sheet2")).copy
This comment was minimized by the moderator on the site
hai sir i want know code for copying multiple sheets in one excel to multiple excels
This comment was minimized by the moderator on the site
Sheets(Array("Sheet1","Sheet2")).copy
This comment was minimized by the moderator on the site
hai sir i want know code for copying multiple sheets in one excel to multiple excels
This comment was minimized by the moderator on the site
how to use VBA code 1 to amend and make it runs to combine all the .xlsx files into one excel file and each excel spreedsheet tab in the combined excel file should be named as original file name.thanks
This comment was minimized by the moderator on the site
What part of VBA code 3 specifies the name of the worksheet to be copied?
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