T
Trevor Williams
Dear All
Can anyone shed any light on why my pivot table won't show the PivotItems
using the following code?
Sub TestPiv()
Dim myPiv As PivotTable, myPI As PivotItem
Set myPiv = ActiveSheet.PivotTables("PivotTable1")
For Each myPI In myPiv.PivotFields("Year to View").PivotItems
'On Error Resume Next
myPI.Visible = True
Next
End Sub
If I record a macro to 'show all' I get the following code which, when run
again, doesn't work either. Very odd.
Sub Macro4()'
' Macro4 Macro
' Macro recorded 06/05/2008 by .
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Year to View")
.PivotItems("2007").Visible = True
.PivotItems("2008").Visible = True
.PivotItems("2010").Visible = True
.PivotItems("2011").Visible = True
.PivotItems("2012").Visible = True
.PivotItems("2013").Visible = True
.PivotItems("2014").Visible = True
End With
End Sub
Any help appreciated
Trevor Williams
Can anyone shed any light on why my pivot table won't show the PivotItems
using the following code?
Sub TestPiv()
Dim myPiv As PivotTable, myPI As PivotItem
Set myPiv = ActiveSheet.PivotTables("PivotTable1")
For Each myPI In myPiv.PivotFields("Year to View").PivotItems
'On Error Resume Next
myPI.Visible = True
Next
End Sub
If I record a macro to 'show all' I get the following code which, when run
again, doesn't work either. Very odd.
Sub Macro4()'
' Macro4 Macro
' Macro recorded 06/05/2008 by .
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Year to View")
.PivotItems("2007").Visible = True
.PivotItems("2008").Visible = True
.PivotItems("2010").Visible = True
.PivotItems("2011").Visible = True
.PivotItems("2012").Visible = True
.PivotItems("2013").Visible = True
.PivotItems("2014").Visible = True
End With
End Sub
Any help appreciated
Trevor Williams