• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

except this words (HMB w/o Retail & HMB with Retail), no filter in pivot report filter vba code

I am trying the macro in pivot table (excel 2013 using)

except this words (HMB w/o Retail & HMB with Retail), no filter in pivot report filter

i got error the code vba



Code:
Sub Macro10()
'
' Macro10 Macro
'

'
    rw = ActiveWorkbook.Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
    Range("A1").Select
    Selection.CurrentRegion.Select
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Sheet1!R1C1:R" & rw & "C6", Version:=xlPivotTableVersion15).CreatePivotTable _
        TableDestination:="", TableName:="PivotTable14", DefaultVersion:= _
        xlPivotTableVersion15
    ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
    ActiveSheet.Cells(3, 1).Select
   
   
    ActiveSheet.PivotTables("PivotTable14").AddDataField ActiveSheet.PivotTables( _
        "PivotTable14").PivotFields("Shift"), "Count of Shift", xlCount
       
   
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Type of Business"). _
        EnableMultiplePageItems = True
       
    ActiveSheet.PivotTables("PivotTable14").RowAxisLayout xlTabularRow
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Plant").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Date").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Shift").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Center").Subtotals = Array _
        (False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Type of Business"). _
        Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _
        False, False)
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Qty Received in KG"). _
        Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _
        False, False)
    ActiveSheet.PivotTables("PivotTable14").RepeatAllLabels xlRepeatLabels
   
   
    With ActiveSheet.PivotTables("PivotTable14").PivotFields("Plant")
        .Orientation = xlRowField
        .Position = 1
    End With
    With ActiveSheet.PivotTables("PivotTable14").PivotFields("Date")
        .Orientation = xlRowField
        .Position = 2
    End With
    With ActiveSheet.PivotTables("PivotTable14").PivotFields("Center")
        .Orientation = xlRowField
        .Position = 3
    End With
    With ActiveSheet.PivotTables("PivotTable14").PivotFields("Shift")
        .Orientation = xlColumnField
        .Position = 1
    End With
   
   
    With ActiveSheet.PivotTables("PivotTable14").PivotFields("Type of Business")
        .Orientation = xlPageField
        .Position = 1
    End With
    ActiveSheet.PivotTables("PivotTable14").PivotFields("Type of Business"). _
        CurrentPage = "(All)"
    With ActiveSheet.PivotTables("PivotTable14").PivotFields("Type of Business")
        .PivotItems("HMB w/o Retail").Visible = True
        .PivotItems("HMB with Retail").Visible = True
    End With
   
End Sub
 
Last edited by a moderator:
Back
Top