Hello,
I am currently trying to make a simple button that filters a PageField in a Pivot table.
This will give me a
Run-time error '1004':
Application-defined or object-defined error
Ive also tried this:
This will run once, remove all the filters and then ignore the last row of code.
If you press it again, it will also give you the same run-time error.
The PageField "DELIVERY SEQUENCE" contains a load of strings, like so:
01. Remote With Parts, 02. Subcontractor Onsite
01. Subcontractor Onsite
01. Remote With Parts, 02. Subcontractor Onsite
01. Subcontractor Onsite
01. Subcontractor Onsite, 02. Subcontractor Onsite
01. Subcontractor Onsite, 02. Subcontractor Onsite
01. Subcontractor Onsite
01. Subcontractor Onsite, 02. Subcontractor Onsite, 03. Subcontractor Onsite
01. Depot(Repair and Return), 02. Subcontractor Onsite
I now want to get it to ON_Click "select multiple selections that all contain "Onsite"".
When I try to record that with the macro recorder, it simply ignores my selection of "Select multiple items" and then subsequent actual selection of multiple items.
Does anyone know what is missing, so everything is defined?
thanks in advance,
Henning
I am currently trying to make a simple button that filters a PageField in a Pivot table.
Code:
Worksheets("SN VIEW (2)").PivotTables("SN").PivotFields("DELIVERY SEQUENCE").PivotFilters.Add Type:=xlCaptionContains, Value1:="*ONSITE*"
Run-time error '1004':
Application-defined or object-defined error
Ive also tried this:
Code:
Dim PvtTbl As PivotTable
Set PvtTbl = Sheets("SN VIEW (2)").PivotTables("SN")
PvtTbl.PageFields("DELIVERY SEQUENCE").ClearAllFilters
PvtTbl.PageFields("DELIVERY SEQUENCE").EnableMultiplePageItems = True
PvtTbl.PageFields("DELIVERY SEQUENCE").PivotFilters.Add Type:=xlCaptionContains, Value1:="*ONSITE*"
This will run once, remove all the filters and then ignore the last row of code.
If you press it again, it will also give you the same run-time error.
The PageField "DELIVERY SEQUENCE" contains a load of strings, like so:
01. Remote With Parts, 02. Subcontractor Onsite
01. Subcontractor Onsite
01. Remote With Parts, 02. Subcontractor Onsite
01. Subcontractor Onsite
01. Subcontractor Onsite, 02. Subcontractor Onsite
01. Subcontractor Onsite, 02. Subcontractor Onsite
01. Subcontractor Onsite
01. Subcontractor Onsite, 02. Subcontractor Onsite, 03. Subcontractor Onsite
01. Depot(Repair and Return), 02. Subcontractor Onsite
I now want to get it to ON_Click "select multiple selections that all contain "Onsite"".
When I try to record that with the macro recorder, it simply ignores my selection of "Select multiple items" and then subsequent actual selection of multiple items.
Does anyone know what is missing, so everything is defined?
thanks in advance,
Henning