Is there a way I can run a macro every time a slicer is selected? Currently I"m using a button to run the macro. I found forums that discuss running the macro on table changes or updates but since the data in the table is actually not changing they do not work. The following is what I've already tried
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Dim n As Integer
n = Application.WorksheetFunction.CountIf(Range("tbl_clients1[visible]"),
"1")
If (n) = 1 Then
Sheets("clientlist").CommandButton2.Visible = True
Else
Sheets("clientlist").CommandButton2.Visible = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim n As Integer
n = Application.WorksheetFunction.CountIf(Range("tbl_clients1[visible]"),
"1")
If (n) = 1 Then
Sheets("clientlist").CommandButton2.Visible = True
Else
Sheets("clientlist").CommandButton2.Visible = False
End If
End Sub