3
當我刷新我的數據,然後使用以下代碼在透視表上執行刷新時,默認情況下會選擇新添加的項目。是否有防止這種情況,因爲這意味着我必須再次入場並取消選擇?添加刷新時的VBA默認情況下選擇了PivotItems
Dim pt As PivotTable
Dim pf As PivotField
For Each pt In Worksheets("Summary").PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
pt.PivotCache.Refresh
For Each pf In pt.PivotFields
pf.AutoSort xlAscending, pf.Name
Next pf
Next pt
Set pf = Nothing
Set pt = Nothing
如何在'pt.PivotCache.Refresh'之前將一些代碼加載到數組/字典/集合中。然後,在'pt.PivotCacheRefresh'之後,循環遍歷這些項並取消選中它們(如果它們不在數組/字典/集合中)。 – 2012-07-13 15:41:01