LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Unhide items in PivotTable

I had the following code from one of the masters here.

Task: Select an item in PivotTable1, Excel select the same item in
PivotTable2. PivotTable2 is a copy of PivotTable1. Items are in a field
called "Shop".

Rerult: After I select an item in PivotTable1, it hided all items in
PivotTable2 except the item was selected in PivotTable1. It means the task
was completed. But in the next time I select another item in PivotTable2,
nothing was changed since everything had beed hided.

Help: I think I need to add somethng into the code to unhide all items in
PivotTable2 before it does the hiding.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim itm As PivotItem
Dim shop As PivotField

On Error GoTo ErrorHandler
Application.EnableEvents = False

Set shop = Me.PivotTables("PivotTable1"). _
PivotFields("Shop")
For Each itm In Me.PivotTables("PivotTable2"). _
PivotFields("Shop").PivotItems
itm.Visible = shop.PivotItems(itm.Caption).Visible
Next itm
Set shop = Nothing
Set itm = Nothing
ErrorHandler:
Application.EnableEvents = True

End Sub

--
Dennis Cheung
 
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
PivotTable - show top items Epinn New Users to Excel 5 October 25th 06 10:07 PM
PivotTable - How to unhide page field items? Epinn New Users to Excel 3 October 16th 06 01:10 PM
PivotTable: Difference from Row Items astrodon Excel Discussion (Misc queries) 1 February 22nd 06 03:13 PM
PivotTable Does not refresh individual items Nick O[_2_] Excel Programming 0 August 23rd 05 10:33 AM
PivotTable - calculated items? Peter Aitken Excel Discussion (Misc queries) 1 July 4th 05 05:50 PM


All times are GMT +1. The time now is 12:00 PM.

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

About Us

"It's about Microsoft Excel"