vba - Unable to get PivotFields property of the PivotTable class -


i'm trying make macro changes filters of several pivottables (not all), i'm getting error on pivotfields, here's sample of code:

sheets("sheet1").pivottables("pivottable" & pivot_counter).pivotfields( _ "[year].[year].[year]").visibleitemlist = array("") 

my questions are:

1- why use pivotfields("[year].[year].[year]") when using visibleitemlist? why have repeat , what's meaning of it, couldn't anywhere.

2- supposedly wrong code? pivot table has field called "year" , filter set specific year (let's 2013) , wanted change possible years.

sub tester()     showall activesheet.pivottables("pivottable1").pivotfields("year") end sub   sub showall(pf pivotfield)     dim pi pivotitem     application.screenupdating = false     each pi in pf.pivotitems         pi.visible = true     next pi     application.screenupdating = true end sub 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -