I have the following code which will loop through each pivot item and mark the listed criteria as FALSE, then for everything show them as TRUE,

When i run the code i get an error on this line - Run-time error '1004':

Unable to set the Visible property of the PivotItem class

PivotItem.Visible = True
Full code of this section is

 For Each PivotItem In .PivotTables("PivotTable1").PivotFields("Stock Code").PivotItems
            If PivotItem.Value = "*MOECA" Or _
                PivotItem.Value = "*MORCA" Or _
                PivotItem.Value = "*POOL" Or _
                PivotItem.Value = "*-B" Then _
                
                PivotItem.Visible = False
            Else
                PivotItem.Visible = True
            End If
        Next PivotItem