+ Reply to Thread
Results 1 to 6 of 6

VBA - Pivot table multiple itens start with...

  1. #1
    Forum Contributor
    Join Date
    06-01-2017
    Location
    Santos
    MS-Off Ver
    Office 2016 - Windows 7
    Posts
    105

    Question VBA - Pivot table multiple itens start with...

    Good afternoon.

    I would like to ask you about a way to select multiple itens on a pivot table, starting by "BK -"
    I tried severals ways but nothing worked till now.

    Below, you will find the code that I have for the moment.
    If someone can help me, will be grateful.

    Please Login or Register  to view this content.
    Last code that I tied is :

    Please Login or Register  to view this content.
    Unfortunatly it did not work.
    Can you please help me ?

    Waiting for your feedback
    Regards
    Last edited by ozstrik3r69; 06-16-2017 at 12:35 PM.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: VBA - Pivot table multiple itens start with...

    Since your "COMMENT_DESCRIPTION" field is in xlPageField.

    You won't be able to use .PivotFilters.

    You will need to iterate over all items in the field.
    Also, since PivotField requires at least 1 item to be visible, to avoid issue, you should set all items to visible before you apply your filter.

    Code should be something like...

    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    06-01-2017
    Location
    Santos
    MS-Off Ver
    Office 2016 - Windows 7
    Posts
    105

    Re: VBA - Pivot table multiple itens start with...

    @CK76


    Thank you for your answer.
    Actually I can see that it works.
    I had to change name for the Dim and so on but actually it works.

    The only "problem" I noted, is that it take too much time to create this filter.
    I was wondering if it took that time because of the quantity of reasons available in the comment descritpion or because it is a long process ?
    If you know a way to get that filter faster, I will be grateful.


    Waiting for your feedback
    Regards

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: VBA - Pivot table multiple itens start with...

    It takes long time, since pivot updates itself every time visible status is set on each item.

    I'd recommend you add following lines.

    Before you start loop.
    Please Login or Register  to view this content.
    Then at end of the procedure.
    Please Login or Register  to view this content.
    EDIT:
    Only other way to speed up the process is to use OLAP based PivotTable.
    OLAP based Pivots has different methods than regular Pivots and does not need to loop through each item.
    Last edited by CK76; 06-16-2017 at 02:17 PM. Reason: See Edit:

  5. #5
    Forum Contributor
    Join Date
    06-01-2017
    Location
    Santos
    MS-Off Ver
    Office 2016 - Windows 7
    Posts
    105

    Re: VBA - Pivot table multiple itens start with...

    Wow !

    I did not know about the OLAP extension.
    It seems a bit complicated but interesting. I will take a look on it.

    Regarding ManualUpdate I will try and will revert asap.

    I was also thinking about another way.
    If it take too long to use the filter "BK -" I have another possibility is to filter by date.
    I have to find a VBA about a way to filter by week number.
    If you know about it, I will be grateful.

    Revert soon & waiting for your feedback
    regards

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: VBA - Pivot table multiple itens start with...

    Regardless of what field is used, unless the field is in Row Label field, code will be very similar to solution above. In that, it has to iterate through each item.

    One way to get around this, is to add helper column to source range. To group items of interest into single value.

+ 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. Pulling the start and end date from a pivot table slicer
    By rwiper11 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 05-27-2015, 08:51 AM
  2. VBA statement to deselect all pivot table itens
    By GPSPOW in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-16-2014, 02:48 AM
  3. [SOLVED] Sumarize Column Itens to Row itens, to ease any PivotTable operation
    By leramone in forum Excel General
    Replies: 5
    Last Post: 08-17-2014, 04:15 PM
  4. Filter Pivot Table Using Start and End Date
    By weeeee0713 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2014, 10:02 PM
  5. Pivot Table - GrandTotal at Start
    By pr4t3ek in forum Excel General
    Replies: 5
    Last Post: 03-27-2014, 01:40 PM
  6. Slicing between start and end dates in a pivot table
    By mwwoodm in forum Excel General
    Replies: 0
    Last Post: 12-06-2011, 01:11 PM
  7. [SOLVED] Start & End Dates in pivot table
    By AngePaton in forum Excel General
    Replies: 0
    Last Post: 01-04-2005, 07:06 AM

Tags for this Thread

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