excel - Creating a Pivot table macro - Need to remove the marked rows through code -


i want marked rows (subtotals) gone, here code pivot table (i coding macro) suggestions? see picture here

    activeworkbook.pivotcaches.add(sourcetype:=xldatabase, sourcedata:=activesheet.usedrange).createpivottable tabledestination:="", tablename:="pivottable1", defaultversion:=xlpivottableversion10 activesheet.pivottablewizard tabledestination:=activesheet.cells(1, 1) activesheet.pivottables("pivottable1").addfields rowfields:="kostenstellen-nr" activesheet.pivottables("pivottable1").addfields rowfields:="konto-nr" activesheet.pivottables("pivottable1").addfields rowfields:="betrag brutto" activesheet.pivottables("pivottable1").pivotfields("kostenstellen-nr").orientation = xlrowfield activesheet.pivottables("pivottable1").pivotfields("konto-nr").orientation = xlrowfield activesheet.pivottables("pivottable1").adddatafield activesheet.pivottables("pivottable1").pivotfields("betrag brutto"), "sum of betrag brutto", xlsum 

you talking subtotals, record macro , change via top ribbon (pivottable tools/design).

add line code :

activesheet.pivottables("pivottable1").pivotfields("kostenstellen-nr").subtotals = array( _     false, false, false, false, false, false, false, false, false, false, false, false)