Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, all, I use VBA to generate a pivot table and Excel adds subtotal to all
row field headers. How can I hide all subtotals in VBA? I tried using Excel's macro recording function, but it only delete single cell which contain the subtotal header. Thanks Huyeote |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Right click grey column header to get menu.
Field - SubTotals ... none Options - uncheck Grand totals for columns/Grand totals for rows With pivot tables it is always best to record macros because the requirements are not exactly intuitive. --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code will turn off the subtotals for all row and column
fields: '========================= Sub NoSubtotals() 'turns off subtotals in pivot table '.PivotFields could be changed to '.RowFields or .ColumnFields Dim pt As PivotTable Dim pf As PivotField On Error Resume Next For Each pt In ActiveSheet.PivotTables For Each pf In pt.PivotFields 'First, set index 1 (Automatic) to True, 'so all other values are set to False pf.Subtotals(1) = True pf.Subtotals(1) = False Next pf Next pt End Sub '======================== Huyeote wrote: Hi, all, I use VBA to generate a pivot table and Excel adds subtotal to all row field headers. How can I hide all subtotals in VBA? I tried using Excel's macro recording function, but it only delete single cell which contain the subtotal header. Thanks Huyeote -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It works perfectly, thanks.
"Debra Dalgleish" wrote in message ... The following code will turn off the subtotals for all row and column fields: '========================= Sub NoSubtotals() 'turns off subtotals in pivot table '.PivotFields could be changed to '.RowFields or .ColumnFields Dim pt As PivotTable Dim pf As PivotField On Error Resume Next For Each pt In ActiveSheet.PivotTables For Each pf In pt.PivotFields 'First, set index 1 (Automatic) to True, 'so all other values are set to False pf.Subtotals(1) = True pf.Subtotals(1) = False Next pf Next pt End Sub '======================== Huyeote wrote: Hi, all, I use VBA to generate a pivot table and Excel adds subtotal to all row field headers. How can I hide all subtotals in VBA? I tried using Excel's macro recording function, but it only delete single cell which contain the subtotal header. Thanks Huyeote -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Subtotals in a Pivot Table | Excel Worksheet Functions | |||
Pivot Table Hide Zero Subtotals - Excel 2007 | Excel Worksheet Functions | |||
can i add subtotals to subtotals in a pivot table? | Excel Discussion (Misc queries) | |||
Can i hide parts of a Pivot tables subtotals??? | Excel Discussion (Misc queries) | |||
how do i only see subtotals in a pivot and hide the detail | Excel Worksheet Functions |