I have a pivot table with 2 Row Label ([RAMI PN] & [U of M]), 1 Column Label [Date], and one Sum of Value [Weekly Inventory].
I had a slicer set up that would allow the user to filter by [RAMI PN], but 2 of the frequent users have Excel 2007, which doesn't allow slicers.
As an alternative, I'm trying to create a userform that allows the user to type in the filter value that he wants.
My userform has 1 ComboBox [cbFilterPN] and a button that runs the following code:
When I click the button [cmdFilter2] on my userform I get the following error on the line pt.PivotFields("RAMI PN").CurrentPage = FilterValue: Run-time error '1004': Unable to set the CurrentPage property of the PivotField class
I cannot figure out how to get past this. The weird thing is I've used this same code in another spreadsheet and it works out fine.
I appreciate any help
Thanks,
Travis
I had a slicer set up that would allow the user to filter by [RAMI PN], but 2 of the frequent users have Excel 2007, which doesn't allow slicers.
As an alternative, I'm trying to create a userform that allows the user to type in the filter value that he wants.
My userform has 1 ComboBox [cbFilterPN] and a button that runs the following code:
Code:
Private Sub cmdFilter2_Click()
Dim pt As PivotTable
Dim FilterValue As String
FilterValue = cbFilterPN.Value
Set pt = Sheets(2).PivotTables("PivotTable1")
Sheets(2).Activate
pt.PivotFields("RAMI PN").ClearAllFilters
ThisWorkbook.RefreshAll
pt.PivotFields("RAMI PN").CurrentPage = FilterValue
Unload Me
End Sub
When I click the button [cmdFilter2] on my userform I get the following error on the line pt.PivotFields("RAMI PN").CurrentPage = FilterValue: Run-time error '1004': Unable to set the CurrentPage property of the PivotField class
I cannot figure out how to get past this. The weird thing is I've used this same code in another spreadsheet and it works out fine.
I appreciate any help
Thanks,
Travis