![]() |
Pivot Tables
I have multiple pivot tables which are linked to data I
import into the Excel file. I would like to use "For each next" code to update all of the pivot tables in the file so I don't have to know the names of the pivot tables. I I use "for each next" for a lot of objects in Excel, but haven't had any luck with the code for a pivot table. Thanks, jc |
Pivot Tables
The following code will refresh all pivot tables in the active workbook:
'============================ Sub RefreshAllPivots() Dim ws As Worksheet Dim pt As PivotTable On Error Resume Next For Each ws In ActiveWorkbook.Worksheets For Each pt In ws.PivotTables pt.RefreshTable Next Next End Sub '========================== jc wrote: I have multiple pivot tables which are linked to data I import into the Excel file. I would like to use "For each next" code to update all of the pivot tables in the file so I don't have to know the names of the pivot tables. I I use "for each next" for a lot of objects in Excel, but haven't had any luck with the code for a pivot table. Thanks, jc -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
All times are GMT +1. The time now is 06:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com