Philip1957
Board Regular
- Joined
- Sep 30, 2014
- Messages
- 185
- Office Version
- 365
- Platform
- Windows
Greetings,
I have this code to set pivot filters that used to work until about a month ago and it's driving me crazy.
When it gets to
I get an error saying "unable to set the Visible property of the Pivot Class.
What on earth changed?
Thanks in advance for any assistance.
~ Phil
I have this code to set pivot filters that used to work until about a month ago and it's driving me crazy.
VBA Code:
Private Sub SetFilter16()
Dim PI As PivotItem
Dim v As Variant
Dim r As Range
Dim pf As PivotField
With Worksheets("Pivot Filters")
Set r = .Range(.Range("D2"), .Cells(.Rows.Count, "D").End(xlUp))
End With
For Each PI In Worksheets("Pivots").PivotTables("Piv16_").PivotFields("Date Conc").PivotItems
PI.Visible = True
Next PI
For Each PI In Worksheets("Pivots").PivotTables("Piv16_").PivotFields("Date Conc").PivotItems
v = Application.Match(PI.Name, r, False)
If IsError(v) Then PI.Visible = False
Next PI
End Sub
When it gets to
VBA Code:
If IsError(v) Then PI.Visible = False
What on earth changed?
Thanks in advance for any assistance.
~ Phil