Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA to Filter a PivotField 1

Status
Not open for further replies.

LGMan

MIS
Aug 27, 2003
233
GB
Hi, I have a PivotField(RD) which currently has 58 AlphaNumric values but I need only to filter the ones that start ‘AB’ which this week is 9 instances

The total list of RD will vary each week, and new records starting ‘AB’ can appear.

Is there a way Within VBA to Filter like this?

I recorded a macro but that just lists each code that I don’t want which is no good for next week when the data may have more new non AB codes
 
Basing on the recorded code, you can loop through pivot items:
Code:
With ActiveSheet.PivotTables("YourPivotTableName").PivotFields("RD")
    For Each Pi In .PivotItems
        if Not Pi.Value like "AB*" Then Pi.Visible = False
    Next Pi
End With


combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top