Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autoshow whole word when typing one item in the data validation bo Learning Curve Excel Worksheet Functions 1 June 16th 08 08:08 AM
Building pivot tables in Excel 2007 based on existing pivot tables? [email protected] Excel Discussion (Misc queries) 4 December 26th 07 08:05 PM
Top 10 autoshow in PivotTables watkincm Excel Discussion (Misc queries) 1 November 8th 07 06:36 AM
(Tom?) Pivot tables, code to refer to all pivot tables on template klysell Excel Programming 0 July 20th 07 09:32 PM
Pivot tables-controlling user interaction with pivot tables Sindhura Excel Programming 0 August 27th 03 02:10 PM


All times are GMT +1. The time now is 11:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"