Candyman8019
Well-known Member
- Joined
- Dec 2, 2020
- Messages
- 1,082
- Office Version
- 365
- Platform
- Windows
I have been trying to automate some refreshing of pivot tables when a tab is activated. I have it working just fine on my system with O365; however, my wife's employer uses Office Pro 2016 and it doesn't work for her. Here's the code that is returning an error 1004 for her:
Any thoughts on what I would need to do differently for this to work on Excel 2016?
Thanks.
Joe
VBA Code:
Private Sub worksheet_activate()
Dim pc As PivotCache
'Refresh Pivot Caches
For Each pc In ActiveWorkbook.PivotCaches
pc.Refresh
Next pc
'Refresh Table
Sheet1.PivotTables("PivotTable2").RefreshTable
end sub
Any thoughts on what I would need to do differently for this to work on Excel 2016?
Thanks.
Joe