Hello friends, hope all is well!

I keep getting the error "Unable to set visible property of the pivotitem class"

I have been trying, but don't know what editing needs to be done to see the code go thru.

I am wondering, what is needed?

Thanks a lot! in advance

Sub Fil2M()
Dim MonRR As String
Dim pf As PivotField, pi As PivotItem

With Worksheets("DBR")

Set pf = Worksheets("DBR").PivotTables("PtRR").PivotFields("Month")
pf.ClearAllFilters
pf.EnableMultiplePageItems = True
MonRR = Worksheets("DBR").Range("ds2").Value
If MonRR = "All" Or MonRR = "" Then
pf.CurrentPage = "All"
Exit Sub
End If

Worksheets("DBR").PivotTables("PTRR").RefreshTable
For Each pi In pf.PivotItems
        pi.Visible = Not IsError(Application.Match(pi.Caption, Range("ds2:ds13"), 0))

Next pi

End With
End Sub