Hello,
I need help slightly modifying some VBA code that I found in an old thread (Link to the old thread is at the bottom). This VBA is automatically changing the pivot filter based on the criteria in the predefined range.
What I'm trying to accomplish is to instead of using the predefined range, I would like to have it reference whatever I have copied to my active clipboard from another application, in my case it'll be only 1 numerical record.
Here is the original code.
https://www.mrexcel.com/forum/excel...o-pivot-filter-visual-basic-applications.html
Thanks in advance!
Nic
I need help slightly modifying some VBA code that I found in an old thread (Link to the old thread is at the bottom). This VBA is automatically changing the pivot filter based on the criteria in the predefined range.
What I'm trying to accomplish is to instead of using the predefined range, I would like to have it reference whatever I have copied to my active clipboard from another application, in my case it'll be only 1 numerical record.
Here is the original code.
Code:
Sub Step_Through_PageFilters()
Dim c As Range
Dim PT As PivotTable
Set PT = Sheets("Item Lookup").PivotTables("PivotTable1")
For Each c In Sheets("Random Demand").Range("O1:O24")
With PT.PivotFields("ITEM_NUMBER")
.ClearAllFilters
On Error Resume Next
.CurrentPage = c.Text
On Error GoTo 0
If .CurrentPage.Value = c.Text Then
[COLOR=#008080]'Run other code here....[/COLOR]
Else
MsgBox c.Text & " pagefield item not found."
End If
End With
Next c
End Sub
https://www.mrexcel.com/forum/excel...o-pivot-filter-visual-basic-applications.html
Thanks in advance!
Nic