Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default PivotField select all

I would like to show all items in PivotFields("PERIOD_NUMBER"). Following is
my code:

Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem

Set pt = Sheets("Pivot2").PivotTables("pvtWageRptCGFS")
Set pf = pt.PivotFields("PERIOD_NUMBER")

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

Problem: I get run time error '1004' Unable to set the Visible Property of
the Pivot Item Class on "pi.Visible = True"

Thanks in advance for any help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PivotField select all

CinqueTerra wrote:
I would like to show all items in PivotFields("PERIOD_NUMBER"). Following is
my code:

Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem

Set pt = Sheets("Pivot2").PivotTables("pvtWageRptCGFS")
Set pf = pt.PivotFields("PERIOD_NUMBER")

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

Problem: I get run time error '1004' Unable to set the Visible Property of
the Pivot Item Class on "pi.Visible = True"

Thanks in advance for any help!


One cause is having an autosort designated in Field Settings,
Advanced. Autosort must be manual before the Visible property can be
set. Something like

pf.AutoSort xlManual, "PERIOD_NUMBER"

before the for loop is entered.

Tom

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default PivotField select all

Awesome! Thanks :-)

" wrote:

CinqueTerra wrote:
I would like to show all items in PivotFields("PERIOD_NUMBER"). Following is
my code:

Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem

Set pt = Sheets("Pivot2").PivotTables("pvtWageRptCGFS")
Set pf = pt.PivotFields("PERIOD_NUMBER")

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

Problem: I get run time error '1004' Unable to set the Visible Property of
the Pivot Item Class on "pi.Visible = True"

Thanks in advance for any help!


One cause is having an autosort designated in Field Settings,
Advanced. Autosort must be manual before the Visible property can be
set. Something like

pf.AutoSort xlManual, "PERIOD_NUMBER"

before the for loop is entered.

Tom


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PivotField select all

This is exactly what I needed too!!!! Thanks a million.

" wrote:

CinqueTerra wrote:
I would like to show all items in PivotFields("PERIOD_NUMBER"). Following is
my code:

Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem

Set pt = Sheets("Pivot2").PivotTables("pvtWageRptCGFS")
Set pf = pt.PivotFields("PERIOD_NUMBER")

For Each pi In pf.PivotItems
pi.Visible = True
Next pi

Problem: I get run time error '1004' Unable to set the Visible Property of
the Pivot Item Class on "pi.Visible = True"

Thanks in advance for any help!


One cause is having an autosort designated in Field Settings,
Advanced. Autosort must be manual before the Visible property can be
set. Something like

pf.AutoSort xlManual, "PERIOD_NUMBER"

before the for loop is entered.

Tom


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
Macro to change the PivotField to sum Vick Excel Discussion (Misc queries) 3 December 21st 05 10:34 PM
How can I hide-Unhide pivotfield using VBA? MB Excel Programming 0 March 16th 05 09:57 PM
hide or unhide pivotfield using a checkbox Richard[_33_] Excel Programming 0 February 10th 05 12:02 PM
Change PivotField Item with macro Hans Excel Programming 5 June 28th 04 02:46 PM
Hiding a pivotfield using code Todd Huttenstine Excel Programming 1 June 10th 04 05:01 PM


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