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
Hiding rows when printing DHallam Excel Discussion (Misc queries) 1 May 21st 06 11:30 AM
Disabling hiding rows rudy Excel Discussion (Misc queries) 2 May 17th 06 02:42 PM
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
Hiding Rows Leaves Labels Blank Laura Excel Discussion (Misc queries) 3 March 24th 06 01:10 PM
Hiding rows before printing DaveM Excel Discussion (Misc queries) 3 April 16th 05 11:38 AM


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