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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

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