Hi,
I have written some code that creates a date-frequency pivot table. I use the grouping feature to group the dates into groups of 7, starting on a particular Sunday defined by the user (Sunday's are the start of our working week). This works fine, but I need to hide the first, second to last, and last PivotItem in order to plot a legible graph. I have searched the web and come up the code below; however, it keeps coming up with the error:
"Unable to set the visible property of the PivotItem class".
Can anyone help?
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Started Date")
Dim i As Variant
Dim last As Variant
last = .PivotItems.Count
For Each i In Array(1, last, last-1)
.PivotItems(i).Visible = False
Next i
.PivotItems("(blank)").Visible = False
End With
Bookmarks