One way is to use a worksheet change event to be triggered when either cell S2 or V2 changes.
Put this in the Sheet1 module (and see attached):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Union(Range("S2"), Range("V2"))) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
On Error Resume Next
With ActiveSheet.PivotTables("PivotTable1").PivotFields(IIf(Target.Address = "$S$2", "Market", "Customer"))
For i = .PivotItems.Count To 1 Step -1
If LCase$(.PivotItems(i)) = LCase$(Target.Value) Or Target.Value = vbNullString Then
.PivotItems(i).Visible = True
Else
.PivotItems(i).Visible = False
End If
Next i
End With
On Error GoTo 0
Application.ScreenUpdating = True
End Sub
See how that works for you.
Bookmarks