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

كيفية مسح عوامل التصفية من جميع أوراق العمل في المصنف النشط في Excel؟

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

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


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

يرجى تشغيل البرنامج النصي VBA أدناه لمسح عوامل التصفية من جميع أوراق العمل في المصنف النشط.

1. في المصنف الذي تريد مسح عوامل التصفية منه ، يرجى الضغط على قديم + F11 مفاتيح لفتح ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

2. في ال ميكروسوفت فيسوال باسيك للتطبيقات الإطار، انقر فوق إدراج > وحدة. ثم انسخ والصق نص VBA أدناه في نافذة الوحدة النمطية. انظر أدناه لقطة الشاشة:

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

Sub Clear_fiter()()
'Updated by Extendoffice 20210625
    Dim xAF As AutoFilter
    Dim xFs As Filters
    Dim xLos As ListObjects
    Dim xLo As ListObject
    Dim xRg As Range
    Dim xWs As Worksheet
    Dim xIntC, xF1, xF2, xCount As Integer
    Application.ScreenUpdating = False
    On Error Resume Next
    For Each xWs In Application.Worksheets
        xWs.ShowAllData
        Set xLos = xWs.ListObjects
        xCount = xLos.Count
        For xF1 = 1 To xCount
         Set xLo = xLos.Item(xF1)
         Set xRg = xLo.Range
         xIntC = xRg.Columns.Count
         For xF2 = 1 To xIntC
            xLo.Range.AutoFilter Field:=xF2
         Next
        Next
    Next
    Application.ScreenUpdating = True

End Sub

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


مقالات ذات صلة:

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

🤖 مساعد 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 (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
@Lorif - delete For Each xWs In Application.Worksheets and one of the Nexts
This comment was minimized by the moderator on the site
Which line should I change to restrict the macro to ONLY the active sheet, rather than all of them?Much appreciated!
This comment was minimized by the moderator on the site
hi, everytime I open the file the macro runs and the filters are cleared, how to avoid that "auto run" of the macro?
This comment was minimized by the moderator on the site
Hi Juan Moreno,
I am sorry for my mistake.Replace the first line:
Sub Auto_Open()withSub Clear_filter()with solve the problem.
This comment was minimized by the moderator on the site
this removes all filters, I wanted something that would clear the filters not remove them.
This comment was minimized by the moderator on the site
Hi Saima,I got your point. The code has been updated in the post to only clear the filters instead of removing them. Please to have a try and sorry for the inconvenience.<div data-tag="code">Sub Auto_Open()
'Updated by Extendoffice 20201113
Dim xAF As AutoFilter
Dim xFs As Filters
Dim xLos As ListObjects
Dim xLo As ListObject
Dim xRg As Range
Dim xWs As Worksheet
Dim xIntC, xF1, xF2, xCount As Integer
Application.ScreenUpdating = False
On Error Resume Next
For Each xWs In Application.Worksheets
xWs.ShowAllData
Set xLos = xWs.ListObjects
xCount = xLos.Count
For xF1 = 1 To xCount
Set xLo = xLos.Item(xF1)
Set xRg = xLo.Range
xIntC = xRg.Columns.Count
For xF2 = 1 To xIntC
xLo.Range.AutoFilter Field:=xF2
Next
Next
Next
Application.ScreenUpdating = True

End Sub
This comment was minimized by the moderator on the site
Thanks this help me alot ;=)
This comment was minimized by the moderator on the site
You fucking scumbag this deleted all our filters! Our whole python script was destroyed as a result of it costing us hours! GO TO HELL YOU SCUMBAGS!!!!!!!!!!!!!!!!
This comment was minimized by the moderator on the site
You're getting free help and degrading others for your own stupid mistakes. People like you deserve a special place in hell
This comment was minimized by the moderator on the site
Why didn't you test it fully before working on your latest file and don't you have backup... work on your IT habits before using harsh language.
This comment was minimized by the moderator on the site
Hi,
Sorry for the mistake. The code has been updated in the post to only clear the filters instead of removing them. Please to have a try and sorry for the inconvenience.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations