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

كيف تطبع كل قواعد التنسيق الشرطي في ورقة عمل؟

من السهل عرض جميع قواعد التنسيق الشرطي في ورقة عمل بالنقر فوقها الصفحة الرئيسية > تنسيق مشروط > إدارة القواعد في Excel ، ولكن هل تعرف كيفية طباعة جميع قواعد تنسيق الشرط في ورقة العمل هذه؟ ستقدم هذه المقالة VBA لحل هذه المشكلة.

اطبع كل قواعد التنسيق الشرطي في ورقة عمل


السهم الأزرق الحق فقاعةاطبع كل قواعد التنسيق الشرطي في ورقة عمل

الرجاء اتباع الخطوات التالية لطباعة جميع قواعد التنسيق الشرطي في ورقة عمل بواسطة VBA.

1. افتح ورقة العمل المحددة التي ستطبع قواعد التنسيق الشرطي الخاصة بها ، واضغط على قديم + F11 مفاتيح معًا لفتح نافذة Microsoft Visual Basic for Applications.

2. انقر إدراج > وحدة، ثم قم بلصق رمز VBA أدناه في نافذة الوحدة النمطية الجديدة.

فبا: سرد كافة قواعد التنسيق الشرطي في ورقة العمل النشطة

Sub M_snb()
Dim xRg As Range, xCell As Range
Dim xFormat As Object
Dim xFmStr, xFmAddress As String
Dim xDic As New Dictionary
Dim xSpArr, xOperatorArr
On Error Resume Next
Set xRg = ActiveSheet.Cells.SpecialCells(xlCellTypeAllFormatConditions)
If xRg Is Nothing Then Exit Sub
xDic.Item("Title") = "Type|Typename|Range|StopIfTrue|Operator|Formula1|Formula2|Formula3"
If xSpArr.Count = 0 Then
xSpArr = Split("Cell Value|Expression|Color Scale|DataBar|Top 10|Icon Sets||Unique Values|Text|Blanks|Time Period|Above Average||No Blanks||Errors|No Errors|||||", "|")
xOperatorArr = Split("xlBetween|xlNotBetween|xlEqual|xlNotEqual|xlGreater|xlLess|xlGreaterEqual|xlLessEqual", "|")
End If
For Each xCell In xRg
Set xFormat = xCell.FormatConditions(1)
xFmAddress = xFormat.AppliesTo.Address
If Not xDic.Exists(xFmAddress) Then
xDic.Item(xFmAddress) = xFormat.Type & "|" & xSpArr(xFormat.Type - 1) & "|" & xFmAddress & "|" & xFormat.StopIfTrue
If Not IsEmpty(xFormat.Operator) Then
xDic.Item(xFmAddress) = xDic.Item(xFmAddress) & "|" & xOperatorArr(xFormat.Operator - 1)
End If
If Not IsEmpty(xFormat.Formula1) Then
xDic.Item(xFmAddress) = xDic.Item(xFmAddress) & "|'" & xFormat.Formula1
End If
End If
Next
If ActiveWorkbook.Worksheets("FmCondictionList") Is Nothing Then
Sheets.Add.Name = "FmCondictionList"
End If
Sheets("FmCondictionList").Cells(1).Resize(xDic.Count) = Application.Transpose(xDic.items)
Sheets("FmCondictionList").Columns(1).TextToColumns , , , , 0, 0, 0, 0, -1, "|"
End Sub

3. انقر الأدوات > مراجع حسابات.

4. في مربع حوار المراجع - VBAProject ، يرجى التحقق من وقت تشغيل البرمجة لـ Microsoft الخيار، وانقر فوق OK زر. انظر لقطة الشاشة:

5. الآن عدت إلى نافذة الوحدة ، من فضلك اضغط F5 مفتاح أو انقر فوق يجري زر لتشغيل هذا VBA.

الآن ورقة عمل جديدة باسم "قائمة FMCondtional"تم إنشاؤه وإضافته قبل ورقة العمل النشطة. وستحصل على جميع قواعد التنسيق الشرطي المدرجة في ورقة العمل هذه.

6. انقر قم بتقديم > طباعة > طباعة لطباعة قائمة قواعد التنسيق الشرطي.


السهم الأزرق الحق فقاعةمقالات ذات صلة:

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

🤖 مساعد 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 (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Regarding the comment by @Eagle, I modified the code to cycle up to 'xCell.FormatConditions.Count' and I retrieved more format conditions, but not all of them.
It appears that this change adds the formats on different ranges for the same cell, but not the same ranges with different formats for the same cell.
I'm not that familiar yet with the code that would extract these extra formats.
This comment was minimized by the moderator on the site
Works fine!
Just two notes regarding the comments before:
* Microsoft Scripting Library must be added, otherwise 'Dim xDic As New Dictionary' cannot be interpreted
* If you have more then 1 rules defined on the same Range, then only the first will be listed (code shell be extended with a cycle from 1 to xCell.FormatConditions.Count)

Thanks a lot!
This comment was minimized by the moderator on the site
Unfortunately doesn't work (excel 2013).
This comment was minimized by the moderator on the site
L'algo est mauvais, il n'y a pas de boucle pour couvrir les cas ou un range aurait plusieurs format conditionnels.
This comment was minimized by the moderator on the site
This works great, but is there a way to get a loop that includes all tabs?
This comment was minimized by the moderator on the site
For me it did create a tab and populate information however it was excluding a lot of the conditional formatting was not included. At the time I ran it I had 112 conditional formatting rules set up but only 8 records displayed in the tab.
This comment was minimized by the moderator on the site
Same for me - it only displayed 7 out of 14 conditional formatting rules. Is there any solution for that?
This comment was minimized by the moderator on the site
this does not work. It creates the tab but does not populate the conditional formatting information
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations