amrita17170909
Board Regular
- Joined
- Dec 11, 2019
- Messages
- 74
- Office Version
- 2019
- 2016
- 2013
- Platform
- Windows
Hi All,
The code is simply to refresh a pivot chart.
I recently introduced an error handler in the code to make it sturdier. I am getting an error as per below:
Run-time error '1004'
Unable to get the PivotTables property of the Worksheet class
Can someone advise what am I doing wrong ?
Amrita
The code is simply to refresh a pivot chart.
I recently introduced an error handler in the code to make it sturdier. I am getting an error as per below:
Run-time error '1004'
Unable to get the PivotTables property of the Worksheet class
VBA Code:
Public Sub PBL_SUB_Refresh_Pivotchart()
' Refresh Pivot chart in "Table 1" tab refreshes the data used to calculate the pivot chart
ActiveWorkbook.RefreshAll
With ActiveSheet.PivotTables("PivotTable6").PivotFields("BRN Description")
.PivotItems("0").Visible = False
.PivotItems("(blank)").Visible = False
End With
ErrHandler:
Debug.Print Err.Number, Err.Description, Err.Source
MsgBox "Error " & Err.Number & ": " & Err.Description & Chr(13) & "From: " & Err.Source & Chr(13) & "Function : " & "PBL_SUB_Refresh_Pivotchart"
Resume Next
End Sub
Can someone advise what am I doing wrong ?
Amrita