Is it possible to not let user Refresh Pivot tables unless a condition is satisfied?. Condition may be as simple as a cell containing a specific data.
You could try something like this...
Sub PivotMacro() Dim pt As PivotTable If Sheet1.Range("A1").Value = "Update PT" Then Set pt = ActiveSheet.PivotTables("MyPivot") pt.RefreshTable End If End Sub
HTH
Regards, Jeff
If you like the answer(s) provided, why not add some reputation by clicking the * below
Please use [ Code ] tags when posting [ /Code ]
Please view/read the Forum rules --- How to mark a thread as solved
Thanks Jeff. I have like 10 pivot tables in a worksheet. However, I do not want the user to refresh it unless the data is generated in the source worksheet.
Is there way to do it for all the pivot tables or would it be efficient to put in a condition to active the pivot table worksheet only if a condition is met?
Thanks,
Booo
You could use something like this...
Sub AllWorkbookPivots() Dim pt As PivotTable Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets For Each pt In ws.PivotTables pt.RefreshTable Next pt Next ws End Sub
HTH
Regards, Jeff
If you like the answer(s) provided, why not add some reputation by clicking the * below
Please use [ Code ] tags when posting [ /Code ]
Please view/read the Forum rules --- How to mark a thread as solved
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks