I don't think you can specifically. If you assign a macro to the slicer, it stops working as a slicer, and there are no events associated with slicers. Nearest thing I can think of would be the worksheet's PivotTableUpdate event and store the old value of the relevant field in a variable which you check each time the table updates.
Thanks for your answer. I am trying to use PivotTableUpdate as you suggest:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
On Error Resume Next
If ActiveSlicer.Name = "slicer_1" Then
' MsgBox "test"
So, I would like to start the macro only if the active Slicer is "slicer_1". Unfortunately, I am getting a compile error saying: "argument not optional". Thus, it seems that I cannot use "ActiveSlicer.Name". How could I get the name for the active Slicer??
I have applied a slicer to a data table, and i dont want user to "clear filters" on the slicers.
The user can only able to use the buttons in the slicers, but the "clear filters" should be disabled, please help me how it can be done by any way.
1- Create an ID for the Table, the ID should be calculated automatically (something like =ROW(Any column in the table)
2- With another sheet or the same sheet use SMALL Function with SUBTOTAL function to extract the ID of the filter. Subtotal Let you work only with the filtered values, in your case only one value.
3- Create a Worksheet_Calculate() event to track when the cell with formula change and add the macro there.