ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro for auto refresh (https://www.excelbanter.com/excel-discussion-misc-queries/244677-macro-auto-refresh.html)

Kim

Macro for auto refresh
 
Is there a macro where I change a cell in one sheet and the pivot table will
auto refresh.

If I change the cell B18 in Dashboard sheet, the pivot table in City sheet
will refresh automatically.

Thanks.

Luke M

Macro for auto refresh
 
Right click on Dashboard sheet tab, view code, paste this in:

'=====
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B18")) Is Nothing Or _
Target.Count 1 Then Exit Sub
'Refreshes all PivotTables in workbook
ThisWorkbook.RefreshAll
End Sub
'======

Note that this requires you the user to change cell B18. The event will not
be triggered if B18 contains a formula whose result changes.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Kim" wrote:

Is there a macro where I change a cell in one sheet and the pivot table will
auto refresh.

If I change the cell B18 in Dashboard sheet, the pivot table in City sheet
will refresh automatically.

Thanks.



All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com