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

วิธีล้างแคชตัวกรอง (รายการเก่า) จาก Pivot Table ใน Excel

ดังภาพด้านล่างนี้แสดงว่าคุณสร้างตาราง Pivot ตามช่วงของข้อมูล หลังจากลบข้อมูลจากช่วงแหล่งที่มารายการเก่าจะยังคงอยู่ในเมนูแบบเลื่อนลงของ Pivot Table แม้ว่าคุณจะรีเฟรช Pivot Table ก็ตาม หากคุณต้องการลบรายการเก่าทั้งหมดออกจากเมนูแบบเลื่อนลงของ Pivot Table วิธีการในบทความนี้สามารถช่วยคุณได้

ล้างแคชตัวกรอง (รายการเก่า) จากตาราง Pivot โดยเปลี่ยนตัวเลือก
ล้างแคชตัวกรอง (รายการเก่า) จากตาราง Pivot ทั้งหมดโดยใช้รหัส VBA


ล้างแคชตัวกรอง (รายการเก่า) จากตาราง Pivot โดยเปลี่ยนตัวเลือก

คุณสามารถล้างแคชตัวกรองจากตาราง Pivot ได้โดยเปลี่ยนตัวเลือก กรุณาดำเนินการดังนี้

1. คลิกขวาที่เซลล์ใดก็ได้ภายใน Pivot Table จากนั้นคลิก ตัวเลือก PivotTable จากเมนูบริบท ดูภาพหน้าจอ:

2 ใน ตัวเลือก PivotTable ใหคลิกปุ the ม ข้อมูล เลือก ไม่มี จาก จำนวนรายการที่จะเก็บรักษาต่อฟิลด์ รายการแบบหล่นลงจากนั้นคลิกที่ OK ปุ่ม

3. คลิกขวาที่เซลล์ Pivot Table จากนั้นคลิก รีเฟรช จากเมนูคลิกขวา ดูภาพหน้าจอ:

จากนั้นคุณจะเห็นรายการเก่าถูกลบออกจากเมนูแบบเลื่อนลงของตาราง Pivot ตามภาพด้านล่างที่แสดง


ล้างแคชตัวกรอง (รายการเก่า) จากตาราง Pivot ทั้งหมดโดยใช้รหัส VBA

หากคุณต้องการล้างแคชตัวกรองจากตาราง Pivot ทั้งหมดในแผ่นงานหลายแผ่นในสมุดงานที่ใช้งานอยู่ โปรดลองใช้สคริปต์ VBA ด้านล่าง

1. ในสมุดงานคุณต้องล้างรายการเก่าจากตาราง Pivot ทั้งหมดให้กดปุ่ม อื่น ๆ + F11 พร้อมกันเพื่อเปิดไฟล์ หน้าต่าง Microsoft Visual Basic for Applications

2 ใน Microsoft Visual Basic สำหรับแอปพลิเคชัน ดับเบิลคลิกที่ไฟล์ สมุดงานนี้ ใน โครงการ บานหน้าต่างเพื่อเปิดไฟล์ ThisWorkbook (รหัส) จากนั้นคัดลอกและวางโค้ด VBA ด้านล่างลงในหน้าต่าง

รหัส VBA: ล้างแคชตัวกรอง (รายการเก่า) จากตาราง Pivot ทั้งหมดในสมุดงานที่ใช้งานอยู่

Private Sub Workbook_Open()
    Dim xPt As PivotTable
    Dim xWs As Worksheet
    Dim xPc As PivotCache
    Application.ScreenUpdating = False
    For Each xWs In ActiveWorkbook.Worksheets
        For Each xPt In xWs.PivotTables
            xPt.PivotCache.MissingItemsLimit = xlMissingItemsNone
        Next xPt
    Next xWs
    For Each xPc In ActiveWorkbook.PivotCaches
        On Error Resume Next
        xPc.Refresh
    Next xPc
    Application.ScreenUpdating = True
End Sub

3 กด F5 เพื่อเรียกใช้รหัสจากนั้นรายการเก่าจะถูกลบออกทันทีจากเมนูแบบเลื่อนลงของตาราง Pivot ทั้งหมดในสมุดงานที่ใช้งานอยู่


บทความที่เกี่ยวข้อง:

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, Visio และโครงการ
  • เปิดและสร้างเอกสารหลายรายการในแท็บใหม่ของหน้าต่างเดียวกันแทนที่จะเป็นในหน้าต่างใหม่
  • เพิ่มประสิทธิภาพการทำงานของคุณ 50% และลดการคลิกเมาส์หลายร้อยครั้งให้คุณทุกวัน!
Comments (14)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Hola. Muchisimas gracias, tu ejemplo practico me ayudo mucho y logre resolver el incovenienre.
Me fui por la primera opción, desde la tabla dinamica.
Rated 5 out of 5
This comment was minimized by the moderator on the site
I am facing similar cache issue in my pivot tables and charts created using Power Pivot. Will the above two options works for Pivot Tables created using Power Pivot? Please let me know, if you have any other solution for Power Pivots.
This comment was minimized by the moderator on the site
Hi Manikanta,
The methods provided in this post haven't tested in Power Pivots, sorry I can't help you.
This comment was minimized by the moderator on the site
Thank you Crystal, for the reply. Can anyone suggest other forums to get the solution to remove filter catch for Power Pivot.
This comment was minimized by the moderator on the site
Hi Manikanta,
Maybe you can post your question in our forum. You may get help from others there.
https://www.extendoffice.com/forum/categories/3-excel.html
This comment was minimized by the moderator on the site
You are Awesome!!
Thank you.
This comment was minimized by the moderator on the site
Merci beaucoup ! Depuis le temps que je cherchais à effacer ces caches.... ce n'était pas évident à trouver, voire impossible sans votre aide !
This comment was minimized by the moderator on the site
Thank you!!
This comment was minimized by the moderator on the site
Sir, Thank you very much. it works wonderfully. I was annoyed by this problem. Thanx a lot.
This comment was minimized by the moderator on the site
run time error '1004'... it does not work for me..why?
This comment was minimized by the moderator on the site
Hi mark,
Which Excel version are you using?
This comment was minimized by the moderator on the site
it works, thank you
This comment was minimized by the moderator on the site
It worked for me. Thank you!
This comment was minimized by the moderator on the site
I got a pivot of a table where the filter shows an incorrect value. The analyst name is A in the filter (set retain values to none) but if you go to the table, the same line has the analyst B. If you double click on the line in the pivot table it generates a sheet with the data where the analyst name is B despite the pivot showing A. This table is updated once a month, it worries me because I often do this, update my raw data and update the pivot, now that I have this precedent I cannot trust the information is correct.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations