+ Reply to Thread
Results 1 to 2 of 2

Select specific Pivot-table item

Hybrid View

bobo1000 Select specific Pivot-table... 10-15-2012, 02:24 AM
bobo1000 Re: Select specific... 10-15-2012, 03:06 AM
  1. #1
    Registered User
    Join Date
    05-16-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    17

    Select specific Pivot-table item

    Hi there. I have a pivot table that is updated every week. Now I would like to write a macro that selects the data only for the calendar week indicated in "A1" of Sheet1.

        Sheets("Sheet5").Select
        With ActiveSheet.PivotTables("PivotTable_Style-RM")
                        .ClearAllFilters
                        .PivotFields("calendar week").PivotItems(("12 - " & Sheets("Sheet1").Range("A1"))).Visible = True
        End With
    can anyone tell me why my concatenate code ("12 - " & Sheets("Sheet1").Range("A1") does not work? I do not get an error, but the macro also does not select any filter.

    Thanks everyone for time and effort in answering this question!

  2. #2
    Registered User
    Join Date
    05-16-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Select specific Pivot-table item

    Hi just found my mistake. When I check for a specific name of a PivotItem I cannot use the .PivotItem.visible = True/False command but must check for the name, using an IF clause that checks the name:
     If .PivotFields("calendar week").PivotItems(r).Name = "12 - " & Sheets("ABC").Range("A1") Then
                               .PivotFields("calendar week").PivotItems(r).Visible = True
                            Else
                                .PivotFields("calendar week").PivotItems(r).Visible = False

+ 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