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

كيفية تجميع الصفوف وفك تجميعها في ورقة العمل المحمية؟

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

قم بتجميع الصفوف وفك تجميعها في ورقة عمل محمية برمز VBA


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

ربما ، لا توجد طريقة أخرى جيدة لحل هذه المشكلة ولكن باستخدام رمز VBA ، يرجى القيام بما يلي:

1. قم بتنشيط ورقة العمل التي تريد استخدامها ، يرجى التأكد من أن ورقة العمل ليست محمية بعد.

2. ثم اضغط باستمرار على ALT + F11 مفاتيح ، ويفتح نافذة ميكروسوفت فيسوال باسيك للتطبيقات.

3. انقر إدراج > وحدة، والصق الكود التالي في ملف نافذة الوحدة.

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

Sub EnableOutlining()
'Update 20140603
Dim xWs As Worksheet
Set xWs = Application.ActiveSheet
Dim xPws As String
xPws = Application.InputBox("Password:", xTitleId, "", Type:=2)
xWs.Protect Password:=xPws, Userinterfaceonly:=True
xWs.EnableOutlining = True
End Sub

4. ثم اضغط F5 مفتاح لتشغيل هذا الرمز ، وسيظهر مربع موجه لتذكيرك بإدخال كلمة المرور لحماية ورقة العمل الحالية. انظر لقطة الشاشة:

doc-group-in-protected-sheet1

5. ثم اضغط OK، تمت حماية ورقة العمل الخاصة بك ، ولكن يمكنك توسيع رموز المخطط التفصيلي وتقليصها في ورقة العمل المحمية هذه ، راجع لقطة الشاشة:

doc-group-in-protected-sheet1

ملاحظات: إذا كانت ورقة العمل الخاصة بك محمية بالفعل ، فلن يعمل هذا الرمز.

أفضل أدوات إنتاجية المكتب

🤖 مساعد Kutools AI: إحداث ثورة في تحليل البيانات على أساس: التنفيذ الذكي   |  إنشاء التعليمات البرمجية  |  إنشاء صيغ مخصصة  |  تحليل البيانات وإنشاء الرسوم البيانية  |  استدعاء وظائف Kutools...
الميزات الشعبية: البحث عن التكرارات أو تمييزها أو تحديدها   |  حذف الصفوف الفارغة   |  دمج الأعمدة أو الخلايا دون فقدان البيانات   |   جولة بدون صيغة 
سوبر بحث: معايير متعددة VLookup    VLookup ذات القيمة المتعددة  |   VLookup عبر أوراق متعددة   |   بحث غامض ....
قائمة منسدلة متقدمة: إنشاء القائمة المنسدلة بسرعة   |  القائمة المنسدلة التابعة   |  قائمة منسدلة متعددة التحديد ....
مدير العمود: إضافة عدد محدد من الأعمدة  |  نقل الأعمدة  |  تبديل حالة رؤية الأعمدة المخفية  |  مقارنة النطاقات والأعمدة 
الميزات المميزة: التركيز على الشبكة   |  عرض تصميم   |   شريط الفورمولا الكبير    مدير المصنفات والأوراق   |  مكتبة الموارد (النص السيارات)   |  منتقي التاريخ   |  اجمع أوراق العمل   |  تشفير/فك تشفير الخلايا    إرسال رسائل البريد الإلكتروني عن طريق القائمة   |  سوبر تصفية   |   مرشح خاص (تصفية غامق / مائل / يتوسطه خط ...) ...
أفضل 15 مجموعة أدوات12 نص الأدوات (إضافة نص, إزالة الأحرف، ...)   |   +50 رسم الأنواع (مخطط جانت، ...)   |   40+ عملي الصيغ (احسب العمر على أساس تاريخ الميلاد، ...)   |   19 إدخال الأدوات (أدخل رمز الاستجابة السريعة, إدراج صورة من المسار، ...)   |   12 تحويل الأدوات (أرقام إلى كلمات, نتيجة تحويل عملة، ...)   |   7 دمج وتقسيم الأدوات (الجمع بين الصفوف المتقدمة, تقسيم الخلايا، ...)   |   ... و اكثر

عزز مهاراتك في Excel باستخدام Kutools for Excel، واختبر كفاءة لم يسبق لها مثيل. يقدم Kutools for Excel أكثر من 300 ميزة متقدمة لتعزيز الإنتاجية وتوفير الوقت.  انقر هنا للحصول على الميزة التي تحتاجها أكثر...

الوصف


يجلب Office Tab الواجهة المبوبة إلى Office ، ويجعل عملك أسهل بكثير

  • تمكين التحرير والقراءة المبوبة في Word و Excel و PowerPointوالناشر والوصول و Visio والمشروع.
  • فتح وإنشاء مستندات متعددة في علامات تبويب جديدة من نفس النافذة ، بدلاً من النوافذ الجديدة.
  • يزيد من إنتاجيتك بنسبة 50٪ ، ويقلل مئات النقرات بالماوس كل يوم!
Comments (33)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Fantástico, me resolveu rápido um grande problema, sua explicação é perfeita, didática, direta sem erros nem enrolação, parabéns. Obrigado!
This comment was minimized by the moderator on the site
Hello,
Thanks for these explanations, it works well.
I have a file with 3 outline symbols.
I would like to enable the user to group and ungroup rows when clicking on the symbols 1 and 2,but to prevent him from ungrouping rows when clicking on the symbol 3.
Is there any way to achieve this ?
Thanks in advance
This comment was minimized by the moderator on the site
这样筛选功能不能用啊
This comment was minimized by the moderator on the site
Is there a way to get this to work on a shared workbook? - I need the track changes, Thanks
This comment was minimized by the moderator on the site
f*ck, this stole my excel later and changed password privately
This comment was minimized by the moderator on the site
How To Group And Ungroup Rows and Columns In Protected Worksheet?
This comment was minimized by the moderator on the site
formidable
This comment was minimized by the moderator on the site
Someone might need this, I think I figured out how to make this work.

First, your code needs to be written in "ThisWorkbook" under Microsoft Excel Objects, as @peachyclean suggests.
Second, take the code that @Sravanthi wrote, and paste to the above mentioned location.

Sub Workbook_Open()
'Update 20140603
Dim xWs As Worksheet
Set xWs = Application.ActiveSheet
Dim xPws As String
xPws = "rfc" ''Application.InputBox("Password:", xTitleId, "", Type:=2)
xWs.Protect Password:=xPws, Userinterfaceonly:=True
xWs.EnableOutlining = True
End Sub

The thing is that you need to be on the sheet which you want to protect but allowing using grouping, and save the workbook and close, without protecting. Now if you open it, the macro starts automatically, it will make the sheet protected with the password "rfc". Now you can use the grouping, the sheet is protected.

For my solution, I've modified the password applied, so you can rewrite any password HERE:
xPws = "WRITEANYPASSWORDHERE" ''Application.InputBox("Password:", xTitleId, "", Type:=2)

Furthermore, I didn't want the to-be-protected sheet active when opening the file, therefore I've modified this part:
Set xWs = Application.ActiveSheet ->
Set xWs = Application.Worksheets("WRITEANYSHEET'SNAMEHERE")

Now it works like charm, sheet named 'WRITEANYSHEET'SNAMEHERE' is protected but the grouping applicable. On the long run, I think the problem will be that if I want to modify this file and keep the solution, I need to unprotect this sheet to make it work on the next opening. I guess you can write another macro to automatically unprotect when closing :)


I hope it helped.
This comment was minimized by the moderator on the site
This string looked to be exactly what I needed, as I know nothing about VBA. I was able to get this to work initially but as was pointed out, once you close the spreadsheet and reopen it, it no longer works. I tried to write the code in "ThisWorkbook" as noted but I can't figure out how to do that. I can see "ThisWorkbook" but I don't know how to write in it. Every way I see to create a module, it creates a new module in a the separate "Modules" folder, outside of the "Microsoft Excel Objects" folder. Any suggestions on how to put this code in "ThisWorkbook" ?
This comment was minimized by the moderator on the site
Hii.. this worked wonders. the only place where i am getting stuck now is that i need to do this for multiple sheets in the workbook. can u pls help with that.
This comment was minimized by the moderator on the site
do you have visuals for the VBA Code discussed 6 days ago to peachyclean about ThisWorkbook under Microsoft Objects instead of a new module. The functionality is lost when I go back into my workbook
This comment was minimized by the moderator on the site
To fix the issue of this not working in your file after you've closed it and opened it again, you have to paste the VBA code in "ThisWorkbook" under Microsoft Excel Objects instead of a new module. This will then automatically run the macro every time the file is opened.
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