1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| Private Sub Worksheet_Change(ByVal Target As Range)
Dim xPTable As PivotTable
Dim xPFile As PivotField
Dim xStr As String
On Error Resume Next
If Intersect(Target, Range("C4")) Is Nothing Then
Application.ScreenUpdating = False
Set xPTable = Worksheets("Share your comments here").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("Accounting Responsible")
xStr = Target.Text
xPTable.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
ElseIf Intersect(Target, Range("C7")) Is Nothing Then
Application.ScreenUpdating = False
Set xPTable = Worksheets("Share your comments here").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("Vendor")
xStr = Target.Text
xPTable.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
ElseIf Intersect(Target, Range("C10")) Is Nothing Then
Application.ScreenUpdating = False
Set xPTable = Worksheets("Share your comments here").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("Line Manager")
xStr = Target.Text
xPTable.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
ElseIf Intersect(Target, Range("C13")) Is Nothing Then
Application.ScreenUpdating = False
Set xPTable = Worksheets("Share your comments here").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("Sales Director")
xStr = Target.Text
xPTable.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
ElseIf Intersect(Target, Range("C16")) Is Nothing Then
Application.ScreenUpdating = False
Set xPTable = Worksheets("Share your comments here").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("CFO")
xStr = Target.Text
xPTable.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
ElseIf Intersect(Target, Range("C19")) Is Nothing Then
Application.ScreenUpdating = False
Set xPTable = Worksheets("Share your comments here").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("CEO")
xStr = Target.Text
xPTable.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End If
End Sub |
Partager