我试图在切片器中取消选择所有预设值,然后根据将每天更新的列表选择值。我设法编写了以下代码,但由于我的预设列表很长,因此运行速度非常慢。有没有办法让以下运行更快?
Sub cmdTop10PrioritySlicer()
Dim i As Integer
Dim MemberID As String
Application.ScreenUpdating = False
ThisWorkbook.SlicerCaches("Slicer1").ClearManualFilter
'Deselect all prior set values
For Each slc In ThisWorkbook.SlicerCaches("Slicer1").SlicerItems
slc.Selected = False
Next slc
'Select values in Slicer based on Top 10 Priority List
For i = 1 To 10
ID = ThisWorkbook.Worksheets("Summary").Range("A" & 57 + i).Value
ThisWorkbook.SlicerCaches("Slicer1").SlicerItems(ID).Selected = True
Next i
Application.ScreenUpdating = True
End Sub