Pivot table in excel macro - auto select field values when the source data changes

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have created a pivot table in Excel with a macro to automatically update the values each day.
I have a number of statuses that can appear against a row of data however Im only interested in returning results using 2 values.
I can select records using a specific value orsearch for values but when I select the 2 search records I want, the code diplays the pivot items I dont want to return as false. These values can change daily and therefore if not available
in the following days data - VBA returns an error.

How do I stipulate the two values that I want to return?

Thanks in advance.
ActiveSheet.PivotTables("PivotTable2").PivotFields("Delivery_Status"). _<br/>
CurrentPage = "(All)"<br/>
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Delivery_Status")<br/>
.PivotItems("Booked").Visible = False<br/>
.PivotItems("Cancelled").Visible = False<br/>
.PivotItems("Not Ready to Release").Visible = False<br/>
.PivotItems("Released to Warehouse").Visible = False<br/>
.PivotItems("Split in Progress").Visible = False<br/>
.PivotItems("Staged/Pick Confirmed").Visible = False<br/>
.PivotItems("(blank)").Visible = False<br/>
End With<br/>
ActiveSheet.PivotTables("PivotTable2").PivotFields("Delivery_Status"). _<br/>
EnableMultiplePageItems = True<br/>
End Sub


<br/>

View the full article
 
Back
Top