excel 2010 vba pivot table report filter update -
i have 16 pivot tables on same sheet, "analytics admin", recorded , cleaned macro below (the code right before updates info pivot tables source). it's same code 16 times, thing changes pivot table name ( msp, msp30, fsp, fsp30, etc). possible change report filter pivot tables @ once?
worksheets("analytics admin").activate 'refreshes data, clears filters filters 0 , blanks out of custom range pareto pivot tables activesheet.pivottables("msp").pivotcache.refresh activesheet.pivottables("msp").pivotfields("count").clearallfilters activesheet.pivottables("msp").pivotfields("count").showallitems = true activesheet.pivottables("msp").pivotfields("count") .pivotitems("0").visible = false .pivotitems("(blank)").visible = false end activesheet.pivottables("msp").pivotcache.refresh activesheet.pivottables("fsp").pivotcache.refresh activesheet.pivottables("fsp").pivotfields("count").clearallfilters activesheet.pivottables("fsp").pivotfields("count").showallitems = true activesheet.pivottables("fsp").pivotfields("count") .pivotitems("0").visible = false .pivotitems("(blank)").visible = false end activesheet.pivottables("fsp").pivotcache.refresh
something along lines of (not tested, typed here)
dim ws worksheet set ws = thisworkbook.worksheets("analytics admin") dim pt pivottable each pt in ws.pivottables ' debug.print pivot.name pt.pivotfields("count").clearallfilters pt.pivotfields("count").showallitems = true pt.pivotfields("count") .pivotitems("0").visible = false .pivotitems("(blank)").visible = false end pt.pivotcache.refresh pt.refreshtable pt.update next
Comments
Post a Comment