Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default [VBA] Hiding rows in PivotTable

Hi,

I have PivotTable in Excel 2003. In "Row Fields" there is dimension called
[DepartmentEmployee] which consists of [Department] and [Employee] levels.
To hide rows I used the following code:
Sub Hide()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables(1)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For Each pf In pt.RowFields
For Each pi In pf.PivotItems
pi.Visible = False
Next pi
Next pf
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

The problem is, that when the code is done there is no change in the layout
of PivotTable.What went wrong?

In this code "for" loops are iterated for Departments and Employees that are
shown in the current layout of PivotTable.
What should I do to make "for" loops iterate for all Departments and
Employees (even the hidden ones).

Thanks for any help.
--
TM

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
Link PivotChart to PivotTable, whilst hiding fields clifgriffin Excel Discussion (Misc queries) 0 March 3rd 09 07:03 PM
Color alternate rows when after hiding selected rows Monk[_2_] Excel Worksheet Functions 6 June 7th 08 01:36 AM
[VBA] Hiding rows in PivotTable xpan Excel Discussion (Misc queries) 1 September 26th 06 11:18 PM
[VBA] Hiding rows in PivotTable xpan Excel Worksheet Functions 1 September 26th 06 11:18 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM


All times are GMT +1. The time now is 11:06 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"