I am getting an error when trying to set the the pivot item to a range. The range ("SK5") would include a name like "Tom Smith", which i would like to be the only option chosen for the filter. I am getting an "Unable to get the PivotItems Property of the PivotField Class" error when i deactivate the "On Error Resume Next" line. I know the name "Tom Smith" exists as a pivotitem, just not sure where the error is coming from.
![]()
Dim dbmitm As Range Dim pvt as PivotTable Set DBM = Sheet1.Range("SK5") Set pvt = ActiveSheet.PivotTables("PivotTable21") On Error Resume Next With pvt21.PivotFields("DBM") .ClearAllFilters .PivotItems(dbmitm).Visible = True End With
Bookmarks