Reputation: 53
I'm trying to make a macro to analyze and update the dynamic table located in the second sheet of the workbook ("TD"), i made a macro but it displays the error '1004' ERROR DEFINED BY THE APPLICATION OR OBJECT, hope you can help me.
Dim wsTD As Worksheet
Dim wbWs As Workbook
Set wbWs = ActiveWorkbook
Set wsTD = wbWs.Worksheets("TD")
wbWs.PivotTables(“TablaDinámica1”).PivotCache.Refresh
wbWs.PivotTables(“TablaDinámica2”).PivotCache.Refresh
Upvotes: 1
Views: 960
Reputation: 57753
You are trying to find your pivot table in a workbook wbWs
not in a worksheet wsTD
. Change it to:
wsTD.PivotTables("TablaDinámica1").PivotCache.Refresh
wsTD.PivotTables("TablaDinámica2").PivotCache.Refresh
Upvotes: 3