Pivot Auto Filter by Cell Text Value

Manishakar

New Member
Joined
Sep 5, 2014
Messages
2
Hi!
I wish to filter a Pivot based on the Value in Defined Cell.
I am not aware of VB Code. Tried to Copy a Code online but not working.




Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range

Set rng=Me.Range("F1")
If Not Application.Intersect(Target, rng) Is Nothing Then
With Sheets("PS Pivot").PivotTables("PS PIVOT DP").PivotFields("Sale in Cans")
.ClearAllFilters
If Len(rng.Value)>0 Then .CurrentPage = rng.Value
End With
End If

End SUb

Wherein F1 is Cell whose Value should be considered for filtering the Pivot.
PS PIVOT is Sheet Name.
PS PIVOT DP is Pivot Table Name.
Sale in Cans is Field Name of Pivot Table.
All of them are in same sheet .

Please, help!

Thanks,
Mani
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Anyone there to resolve....? :confused::confused:

Hi!
I wish to filter a Pivot based on the Value in Defined Cell.
I am not aware of VB Code. Tried to Copy a Code online but not working.




Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range

Set rng=Me.Range("F1")
If Not Application.Intersect(Target, rng) Is Nothing Then
With Sheets("PS Pivot").PivotTables("PS PIVOT DP").PivotFields("Sale in Cans")
.ClearAllFilters
If Len(rng.Value)>0 Then .CurrentPage = rng.Value
End With
End If

End SUb

Wherein F1 is Cell whose Value should be considered for filtering the Pivot.
PS PIVOT is Sheet Name.
PS PIVOT DP is Pivot Table Name.
Sale in Cans is Field Name of Pivot Table.
All of them are in same sheet .

Please, help!

Thanks,
Mani
 
Upvote 0

Forum statistics

Threads
1,222,241
Messages
6,164,787
Members
451,916
Latest member
Ndk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top