Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm trying to write a macro that removes all items in the "data" field of a pivot table. To remove a particular field, in this case the field called "Sum of FP01" you could use a macro such as this: ActiveSheet.PivotTables("Central").PivotFields("Su m of FP01").Orientation = _ xlHidden However if you do not have that field in the table it creates and error. How would I say "remove ANY data from the data field?" Many thanks, Brad |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Dim PF as PivotField With ActiveSheet.PivotTables("Central") For Each PF In .PivotFields .Orientation = xlHidden Next PF End With regards Paul ActiveSheet.PivotTables("Central").PivotFields("Su m of FP01").Orientation = _ xlHidden On Nov 13, 10:24*am, Bradley Searle wrote: Hi, I'm trying to write a macro that removes all items in the "data" field of a pivot table. To remove a particular field, in this case the field called "Sum of FP01" you could use a macro such as this: ActiveSheet.PivotTables("Central").PivotFields("Su m of FP01").Orientation = _ * * * * xlHidden However if you do not have that field in the table it creates and error. How would I say "remove ANY data from the data field?" Many thanks, Brad |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your help Paul!
I think your code will probably take all fields away (not just the datafields) - but having not tested it I'm not 100%. I've not tested it because I found a solution - it is: ActiveSheet.PivotTables("Central").DataPivotField. Orientation = xlHidden This simply removes all the data fields, leaving row, column and filter fields in tact. " wrote: Hi Dim PF as PivotField With ActiveSheet.PivotTables("Central") For Each PF In .PivotFields .Orientation = xlHidden Next PF End With regards Paul ActiveSheet.PivotTables("Central").PivotFields("Su m of FP01").Orientation = _ xlHidden On Nov 13, 10:24 am, Bradley Searle wrote: Hi, I'm trying to write a macro that removes all items in the "data" field of a pivot table. To remove a particular field, in this case the field called "Sum of FP01" you could use a macro such as this: ActiveSheet.PivotTables("Central").PivotFields("Su m of FP01").Orientation = _ xlHidden However if you do not have that field in the table it creates and error. How would I say "remove ANY data from the data field?" Many thanks, Brad |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
fields names do not show in excel 2007 pivot table fields list | New Users to Excel | |||
Data Fields in Pivot Table | Excel Programming | |||
Data Fields in Pivot Table | Excel Discussion (Misc queries) | |||
how can I convert data with fields in rows to fields as columns | Excel Discussion (Misc queries) | |||
number of fields in the row fields in pivot table | Excel Discussion (Misc queries) |