I have tried copying and pasting solutions from the internet forever now to try to filter a pivot table in Excel using VBA. The code below doesn\'t work.
In Excel 2007 onwards, you can use the much simpler code using a more precise reference:
dim pvt as PivotTable
dim pvtField as PivotField
set pvt = ActiveSheet.PivotTables("PivotTable2")
set pvtField = pvt.PivotFields("SavedFamilyCode")
pvtField.PivotFilters.Add xlCaptionEquals, Value1:= "K123223"