Results 1 to 12 of 12

Unable to set the visible property of the PivotItem class

Threaded View

RagonichaFulva Unable to set the visible... 02-24-2012, 01:14 PM
RagonichaFulva Re: Unable to set the visible... 02-24-2012, 01:29 PM
RagonichaFulva Re: Unable to set the visible... 02-24-2012, 01:57 PM
RagonichaFulva Re: Unable to set the visible... 02-27-2012, 05:41 AM
RagonichaFulva Re: Unable to set the visible... 02-27-2012, 05:50 AM
RagonichaFulva Re: Unable to set the visible... 02-27-2012, 06:39 AM
OnErrorGoto0 Re: Unable to set the visible... 02-27-2012, 06:40 AM
RagonichaFulva Re: Unable to set the visible... 02-27-2012, 06:52 AM
matt101010 Re: Unable to set the visible... 08-28-2012, 02:31 PM
RagonichaFulva Re: Unable to set the visible... 08-29-2012, 02:51 AM
OnErrorGoto0 Re: Unable to set the visible... 02-27-2012, 07:04 AM
RagonichaFulva Re: Unable to set the visible... 02-27-2012, 07:21 AM
  1. #1
    Registered User
    Join Date
    11-28-2011
    Location
    Barcelona
    MS-Off Ver
    Excel 2007
    Posts
    74

    Unable to set the visible property of the PivotItem class

    Hello,

    I am trying to control the filters of a pivot table according to the .text of 2 combo boxes.

    Everything works OK until I try to changing from visible to not visible certain items.

    Here's my code:


    filterName = Sheets("Reports").ComboBox1.Text
    elementName = Sheets("Reports").ComboBox2.Text
    
    If filterName <> "" Or elementName <> "" Then
        
        With pt.PivotFields(filterName)
            
            .AutoSort xlManual, .SourceName
            Debug.Print "The source name of theb field is: " & .SourceName
            
            For Each ptItem In pt.PivotFields(filterName).PivotItems
                Debug.Print "Checking for " & ptItem.Name & "."
                If ptItem.Name = elementName Then
                    ptItem.Visible = True
                    Debug.Print "Values for " & ptItem.Name & " are visible."
                Else
                    ptItem.Visible = False
                    Debug.Print "Values for " & ptItem.Name & " are NOT visible."
                End If
            Next ptItem
            
            .AutoSort xlAscending, .SourceName
            
        End With
        
    End If
    I have read that it might be a bug, but it's been in forum posts from long ago, an it was solved with:

    .AutoSort xlManual, .SourceName
    Nevertheless, in my case it still displays the following error when I execute this code:

    Error 1004: Unable to set the visible property of the PivotItem class
    I am using MS Excel 2007. I would much appreciate your assistance.
    Last edited by RagonichaFulva; 02-27-2012 at 07:22 AM.

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