I have some sample code below that is working fine for me. Currently has one filter (on Facility Number) and I want to add another filter.
- Private Sub PopulateRentalSpaceUsage() 'get combobox items for "Rental Space Type for selection by user'
- myfilterFacNum = Sheets("AdminCtrls").Range("B12").Value 'Value 1 Filter
- Set PvtTblRental = Worksheets("AdminCtrls").PivotTables("pt_UsageRS")
- myfilterTypePS = Sheets("AdminCtrls").Range("B15").Value
- With PvtTblRental
- .PivotFields("Facility Number").ClearLabelFilters
- .PivotFields("Facility Number").PivotFilters.Add Type:=xlCaptionEquals, Value1:=myfilterFacNum
- End With
- 'get all "PS Usage Type" items for the combobox"
- For Each cellRS In Range("RS_ptRange")
- ThisrowRS = cellRS.row
- If Not cellRS.Rows.Hidden And ThisrowRS <> LastrowRS Then
- cbo_SelectRentalUsage.AddItem cellRS.Value
- End If
- LastrowRS = ThisrowRS
- Next cellRS
- End Sub
I am having a problem with this line.
.PivotFields("Facility Number").PivotFilters.Add Type:=xlCaptionEquals, Value1:=myfilterFacNum
Which filters the pt as desired. But how do I add a "second filter" - seems I cannot get the syntax correct. thanks for your suggestions.