刷新(多表)
Sub activepath()
Dim sht, st As Worksheet
Set st = ThisWorkbook.Worksheets("aaa") '透视表所在sheet
Set sht = ThisWorkbook.Worksheets("bbb") '透视表源数据所在sheet
arr = Array("数据透视表1", "数据透视表2", "数据透视表3")
With st
For i = LBound(arr) To UBound(arr)
.PivotTables(arr(i)).ChangePivotCache ActiveWorkbook.PivotCaches.Create _
(SourceType:=xlDatabase, SourceData:=sht.[a1].CurrentRegion, Version:=xlPivotTableVersion14)
Next
'单个刷新
'ActiveSheet.PivotTables("数据透视表1").PivotCache.Refresh
'或者Worksheets("透视").PivotTables("数据透视表1").PivotCache.Refresh
End With
ActiveWorkbook.RefreshAll
MsgBox "OK"
End Sub