Hi all
I want to run a macro when a pivot table is updated by a slicer. The macro will hide blank rows in Sheet1. This is the code I was using to do this when the pivot table was on Sheet 1.
I have now had to move the pivot table to another sheet (Sheet3) and I am using slicers on Sheet1 (linked to the pivot table in Sheet 3) to update the data shown on the page.
I cannot figure out how to run the macro to hide the rows when the pivot table is not on the same sheet as the rows that need hiding.
Basically, I want the macro to run when I use a slicer to change the pivot table on another sheet.
Please could someone help with the code I need to do this?
Many thanks
Best Wishes
Kev
----------------------------------------------------------------------------
Mod Edit: Code Tags added
I want to run a macro when a pivot table is updated by a slicer. The macro will hide blank rows in Sheet1. This is the code I was using to do this when the pivot table was on Sheet 1.
Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Application.Run "'Sales Report.xlsm'!hideEmptyRows1"
End Sub
I have now had to move the pivot table to another sheet (Sheet3) and I am using slicers on Sheet1 (linked to the pivot table in Sheet 3) to update the data shown on the page.
I cannot figure out how to run the macro to hide the rows when the pivot table is not on the same sheet as the rows that need hiding.
Basically, I want the macro to run when I use a slicer to change the pivot table on another sheet.
Please could someone help with the code I need to do this?
Many thanks
Best Wishes
Kev
----------------------------------------------------------------------------
Mod Edit: Code Tags added
Last edited by a moderator: