Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot Tables - using .AutoShow
I am coding PivotTable creation and want to display only the top 8
items after using .AutoSort and .AutoShow. At the moment, I'm adding the Row, Column and Data Fields and then .AutoSort and .AutoShow. My problem is that once I add the DataField, the pivot table overwrites sheet formatting. Is there a way to apply .AutoShow BEFORE adding the DataField? Thanks in advance Paul Martin Melbourne, Australia |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot Tables - using .AutoShow
For the benefit of others, I worked out a solution, which is to add
the DataField first, then AutoSort and AutoShow, then add the RowField and ColumnField. My code looks like this: Set pt = ws.PivotTables("ptTest") With pt .AddDataField .PivotFields("Blah"), "Sum of Blah", xlSum With .PivotFields("CauseCatType") .AutoSort xlDescending, "Sum of Blah" .AutoShow xlAutomatic, xlTop, 8, "Sum of Blah" End With .AddFields "CauseCatType", "Category" End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Autoshow whole word when typing one item in the data validation bo | Excel Worksheet Functions | |||
Building pivot tables in Excel 2007 based on existing pivot tables? | Excel Discussion (Misc queries) | |||
Top 10 autoshow in PivotTables | Excel Discussion (Misc queries) | |||
(Tom?) Pivot tables, code to refer to all pivot tables on template | Excel Programming | |||
Pivot tables-controlling user interaction with pivot tables | Excel Programming |