Hello,
Thanks to Matt I now know how to de-select all the items in a specific pivot field using VBA. The code he gave me is pasted below.
The challenge now is to select specific items. When I try the following command I get an error.
Here is the code:
With ActiveSheet.PivotTables("Query_Data").PivotFields("Begin_time")
.PivotItems("11-Jun").Visible = True
End With
Here is the error:
Unable to set the Visible property of the PivotItem class
Here is the code used to de-select all PivotItems:
Dim I As Integer
Dim Item As Object
I = 0
For Each Item In ActiveSheet.PivotTables("Query_Data").PivotFields("Begin_Time").PivotItems
If I >= 1 Then
With ActiveSheet.PivotTables("Query_Data").PivotFields("Begin_Time")
Item.Visible = False
End With
End If
I = I + 1
Next
Thanks to Matt I now know how to de-select all the items in a specific pivot field using VBA. The code he gave me is pasted below.
The challenge now is to select specific items. When I try the following command I get an error.
Here is the code:
With ActiveSheet.PivotTables("Query_Data").PivotFields("Begin_time")
.PivotItems("11-Jun").Visible = True
End With
Here is the error:
Unable to set the Visible property of the PivotItem class
Here is the code used to de-select all PivotItems:
Dim I As Integer
Dim Item As Object
I = 0
For Each Item In ActiveSheet.PivotTables("Query_Data").PivotFields("Begin_Time").PivotItems
If I >= 1 Then
With ActiveSheet.PivotTables("Query_Data").PivotFields("Begin_Time")
Item.Visible = False
End With
End If
I = I + 1
Next