Results 1 to 6 of 6

VBA - Pivot table multiple itens start with...

Threaded View

ozstrik3r69 VBA - Pivot table multiple... 06-16-2017, 12:31 PM
CK76 Re: VBA - Pivot table... 06-16-2017, 01:24 PM
ozstrik3r69 Re: VBA - Pivot table... 06-16-2017, 02:00 PM
CK76 Re: VBA - Pivot table... 06-16-2017, 02:15 PM
ozstrik3r69 Re: VBA - Pivot table... 06-16-2017, 02:41 PM
CK76 Re: VBA - Pivot table... 06-16-2017, 02:59 PM
  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.

        Dim p_i As PivotItem
        
        Dim objTable As PivotTable, objField As PivotField
        
        ActiveWorkbook.Sheets("DataBase").Select
        Range("A1").Select
        
        Set objTable = Sheet1.PivotTableWizard
        ActiveSheet.Name = "Booking Desk"
       
        Set objField = objTable.PivotFields("CS_RESPONSIBLE")
        objField.Orientation = xlRowField
        Set objField = objTable.PivotFields("RESPONSIBILITY_NAME")
        objField.Orientation = xlColumnField
        Set objField = objTable.PivotFields("COMMENT_DESCRIPTION")
        objField.Orientation = xlPageField
        objField.Position = 1
        
    
        Set objField = objTable.PivotFields("RESPONSIBILITY_NAME")
        objField.Orientation = xlDataField
        objField.Function = xlCount
        
        ActiveSheet.PivotTables(1).Name = "BookingDesk"
          
        With ActiveSheet.PivotTables("BookingDesk").PivotFields("RESPONSIBILITY_NAME")
            .PivotItems("Booking Desk").Visible = True
            For Each p_i In .PivotItems
                If p_i.Name <> ("Booking Desk") Then
                    p_i.Visible = False
                End If
            Next
        End With
        
        With ActiveSheet.PivotTables("BookingDesk").PivotFields("CS_RESPONSIBLE")
            On Error Resume Next
            .PivotItems("Adriana Ortigueira").Visible = True
            .PivotItems("Caio Carvalho").Visible = True
            .PivotItems("Daniel Alves").Visible = True
            .PivotItems("Fábio Ignácio").Visible = True
            .PivotItems("Ikaro Vieira").Visible = True
            .PivotItems("Juliana Tenório").Visible = True
            .PivotItems("Kleber Cardozo").Visible = True
            .PivotItems("Lucas Silva").Visible = True
            .PivotItems("Marcelle Bueno").Visible = True
            .PivotItems("Nara Santos").Visible = True
            .PivotItems("Pedro Cardoso").Visible = True
            .PivotItems("Robson Santos").Visible = True
            .PivotItems("Thiago Fernandes").Visible = True
            .PivotItems("Cintia Migues").Visible = False
            .PivotItems("Ronaldo Magueta").Visible = False
            .PivotItems("Talita Santos").Visible = False
            .PivotItems("André de Jesus").Visible = False
            On Error GoTo 0
        End With
        
        ActiveSheet.PivotTables("BookingDesk").ColumnGrand = False
        ActiveSheet.PivotTables("BookingDesk").TableStyle2 = "PivotStyleDark16"
    
        With ActiveSheet.PivotTables("BookingDesk")
            .ColumnGrand = True
            .RowGrand = False
        End With
           
    End Sub
    Last code that I tied is :

        Dim var As Variant
        var = "BK -*"
     
     With ActiveSheet.PivotTables("BookingDesk").PivotFields("COMMENT_DESCRIPTION")
            On Error Resume Next
        EnableMultiplePageItems = True
        .PivotFilters. _
        add Type:=xlCaptionDoesNotEqual, Value1:=var
        On Error GoTo 0
        End With
    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.

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. 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