Hmmm, should have worked (famous last words)
If you want, try this version
I added two Msgboxs and moved the On Error to which handles no pivot field named Memo and no PivotItem = Namex
Option Explicit
Sub filterPivot()
Dim pt As PivotTable
MsgBox ActiveSheet.PivotTables.Count
For Each pt In ActiveSheet.PivotTables
MsgBox pt.Name
On Error Resume Next
With pt.PivotFields("Memo")
.PivotItems("Name1").Visible = False
.PivotItems("Name2").Visible = False
.PivotItems("Name3").Visible = False
.PivotItems("Name4").Visible = False
.PivotItems("Name5").Visible = False
.PivotItems("Name6").Visible = False
End With
On Error GoTo 0
Next
End Sub