April 27, 2024

MoDCore

Welcome to the core

Update all Pivots and Graphs – One Button

Update all Pivots and Graphs – One Button

This code will Update all pivot tables and pivot graphs in the entire workbook, which will save time in manually updating all tables, sheets and graphs!

Open the Developer tab – Click here to see how to, we use this tab allot. – The starting point

Pop the code into a VBA Module and connect the required button to the code.

Sub RefreshButton1
Dim i As Integer
Dim PvtTbl As pivotTable
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
n = 0
For Each PvtTbl In ws.PivotTables
n = n + 1
Next
If n >= 1 Then
For i = 1 To n
ws.PivotTables(i).PivotCache.refresh
Next i
End If
Next
End Sub
This will refresh the tables and graphs but only if the data is in the relevant table in the workbook.
Work smart not hard!
Copyright © All rights reserved. | Newsphere by AF themes.