+ Reply to Thread
Results 1 to 4 of 4

PivotField select all

  1. #1
    CinqueTerra
    Guest

    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. #2
    tlaw37@us.identify.com
    Guest

    Re: 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. #3
    CinqueTerra
    Guest

    Re: PivotField select all

    Awesome! Thanks :-)

    "tlaw37@us.identify.com" 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. #4
    DispACH
    Guest

    Re: PivotField select all

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

    "tlaw37@us.identify.com" 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1