Macro for auto refresh


K

Kim

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.
 
Ad

Advertisements

L

Luke M

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top