My code:
If Not Intersect Target and Pivot Table
Private Sub Worksheet_Change(ByVal Target As Range)
Dim PT1 As PivotTable
If Not Intersect(Target, Range("B7")) Is Nothing Then
Set PT1 = Sheets("PIVOT").PivotTables("MainPivotTable")
PT1.PivotFields("Team").CurrentPage = Sheets("Summary").Range("B7").Value
Set PT1 = Nothing
End If
What does the code do?
The value chosen from the list in Cell B7 updates the Page field of the Pivot Table "MainPivotTable" and consequently a table gets the data updated (getpivot data)
My query
What about If I choose a value from the list in Cell B7 that does not exist in the pivot table? Is there a way to get a message box saying "value doesn't exist"?
If Not Intersect Target and Pivot Table
Private Sub Worksheet_Change(ByVal Target As Range)
Dim PT1 As PivotTable
If Not Intersect(Target, Range("B7")) Is Nothing Then
Set PT1 = Sheets("PIVOT").PivotTables("MainPivotTable")
PT1.PivotFields("Team").CurrentPage = Sheets("Summary").Range("B7").Value
Set PT1 = Nothing
End If
What does the code do?
The value chosen from the list in Cell B7 updates the Page field of the Pivot Table "MainPivotTable" and consequently a table gets the data updated (getpivot data)
My query
What about If I choose a value from the list in Cell B7 that does not exist in the pivot table? Is there a way to get a message box saying "value doesn't exist"?