当我刷新我的数据,然后使用以下代码对我的数据透视表进行刷新时,默认情况下会选择新添加的项目。有没有办法防止这种情况,因为这意味着我必须再次进入并取消选择?
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