RefreshAll Workbook method in VBA is used to refreshes all data ranges and available pivot table reports in the specified workbook.

VBA RefreshAll Method Excel Workbook Object

Why we use RefreshAll Workbook method in VBA?

We use ‘RefreshAll’ Workbook method in VBA to refreshes data ranges and pivot table reorts in the mentioned workbook.

VBA RefreshAll Workbook Method – Syntax

Here is the syntax to RefreshAll workbook method using VBA.

Workbooks(“Your Workbook Name”).RefreshAll

In the above syntax Workbook represents object and RefreshAll represents the method of workbook object.

VBA RefreshAll Workbook Method:Example 1

Please find the below example, It will show you how to do refresh entire active workbook.

Sub Workbook_RefreshAll()
End Sub

VBA RefreshAll Workbook:Example 2

Here is the one more example, it will refreshes the specific workbook.

Sub Workbook_RefreshAll()
End Sub

VBA RefreshAll Workbook: Example 3

Here is the one more example, it will refreshes the second workbook.

Sub Workbook_RefreshAll2()
End Sub

VBA RefreshAll Workbook: Pivot Tables

Here is the one more example, it will refreshes all pivot tables which are available in active sheet of the workbook.

Sub Workbook_PivotTables()
Dim pvtTbl As pivotTable
For Each pvtTbl In ActiveSheet.PivotTables
End Sub

VBA RefreshAll Workbook Method- Instructions

Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:

  1. Open an Excel Workbook
  2. Press Alt+F11 to Open VBA Editor
  3. Insert a Module from Insert Menu
  4. Copy the above code for activating a range and Paste in the code window(VBA Editor)
  5. Save the file as macro enabled workbook
  6. Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line.

Hey! Join Our Community

Get Quick Responses & Experts' Answers in Minutes!
Get Notified - When Answered Your Question!