Hello guys
I'm trying to do a pivot table using VBA alongside multiple other things, however I'm trying to filter the pivot table using the VBA to have account_number to be equal to 123456, I've done this code, however I don't know how to add the extra line to filter as mentioned above.
Is there a way to add the filter to the above mentioned code?
Thanks in advance.
I'm trying to do a pivot table using VBA alongside multiple other things, however I'm trying to filter the pivot table using the VBA to have account_number to be equal to 123456, I've done this code, however I don't know how to add the extra line to filter as mentioned above.
VBA Code:
Set ws = ActiveSheet
Set wb = ThisWorkbook
Set pc = wb.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Range("Bank[#All]"), _
Version:=xlPivotTableVersion15)
Set pt = ws.PivotTables.Add(PivotCache:=pc, TableDestination:=Range("AR2"), TableName:="Pivot")
With pt
.PivotFields("narrative_account_number").Orientation = xlRowField
.PivotFields("Debit amount").Orientation = xlDataField
End With
Is there a way to add the filter to the above mentioned code?
Thanks in advance.