Categorized | excel tips

Refresh All Pivots in a Workbook or Worksheet


The following code will refresh all pivot tables in an excel workbook or a worksheet. There are two ways to achieve this:

Refresh all pivots in Workbook – Method 1
Sub try1()
For Each pt In ActiveWorkbook.PivotCaches
Next pt
End Sub

Refresh all pivots in Workbook – Method 1
Sub try2()
For Each sht In ActiveWorkbook.Worksheets
For Each pt In ActiveSheet.PivotTables
Next pt
Next sht
End Sub

Excel Formula, Excel Chart, Excel Macro, Excel VBA, Pivot Table Excel, Excel Dashboard

What Do You Think ?

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Comments and Trackbacks

  1. George wrote:

    You’ve got the issue of not defining sht & pt

    For beginners this would cause an issue.


Keep up with the latest stories - Delivered right to your inbox


English flagItalian flagKorean flagChinese (Simplified) flagPortuguese flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagDutch flagHindi flagFilipino flagIndonesian flagThai flagTurkish flagPersian flag
treeemap software for excel