+ Reply to Thread
Results 1 to 2 of 2

Filter pivot VBA

  1. #1
    Registered User
    Join Date
    01-11-2014
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    41

    Filter pivot VBA

    Hi

    I need help with Pivot filter. I have VBA that needs to does a lot of things and one of the requirement for filtering pivot is to filter anything that is "Apple" and "blank" rows. Some worksheets only has "Apples" and "Blank" rows. While some worksheets has "Orange", "Banana", "Apples", Blank" rows. But in anycase, i only need to just filter anything that is "Apple" and "Blank". Playing around with visible=true or false does not work. Can anyone help?


    Sub test()

    wb1.Sheets("test").Select
    ActiveSheet.PivotTables("PivotTable4").PivotCache.Refresh
    ActiveSheet.PivotTables("PivotTable4").PivotFields("Type"). _
    CurrentPage = "(All)"
    On Error Resume Next
    With ActiveSheet.PivotTables("PivotTable4").PivotFields("Type")
    .PivotItems("Apple").Visible = False
    .PivotItems("(blank)").Visible = True
    End With
    On Error Resume Next

    End Sub
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Filter pivot VBA

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 04-24-2020, 04:56 AM
  2. Replies: 1
    Last Post: 02-25-2018, 09:47 PM
  3. Two pivot tables with the filter of pivot table 2 to automatically update to filter 1
    By StefaniaLa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2018, 06:19 PM
  4. Inserting filter into pivot table via macro errors if filter doesn't exist.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2018, 10:24 AM
  5. Macro to filter a pivot whilst looping through filter criteria in a variable list.
    By Alistairm88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2015, 04:25 AM
  6. Change Pivot table Filter Based on Cell Value *Multiple Filter items* Possible?
    By Flydd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2012, 06:57 AM
  7. Filter several pivot tables by one programmed date range filter in Excel 2003
    By olewka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2011, 11:49 AM

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