excel vba - Error 1004: Unable to set the Visible property of the Pivot Item class -
below vba script, pivot table wont update. pivot.items set false how fix this?
objwb.pivotcaches.create(sourcetype:=xldatabase, sourcedata:= _ wsdata & "!r1c1:r65536c7", version:=xlpivottableversion12).createpivottable _ tabledestination:="'" & wsname & "'!r3c1", tablename:=wsname, defaultversion _ :=xlpivottableversion12 objws.pivottables(wsname).pivotfields("team") '1st pivot field selected data table .caption = "team" ' rename field cleaner .orientation = xlrowfield ' row field .position = 1 ' 1st level row field .pivotitems("(blank)").visible = false ' hide/filter fields (blank value) - needs done since we're selecting entire worksheet worth of fields , there blanks rows included end '1st field done objws.pivottables(wsname).pivotfields("agent") '2nd pivot field selected data table .caption = "agent" ' rename field cleaner .orientation = xlrowfield ' row field .position = 2 ' 2nd level row field end '2nd field done objws.pivottables(wsname).pivotfields("date") '3rd pivot field selected data table .orientation = xlcolumnfield ' column field end 'done selecting 3rd field - must establish value setting objws.pivottables(wsname).pivotfields("pctadh") '3rd pivot field selected data table .orientation = xlcolumnfield ' column field end
Comments
Post a Comment