Filter Pivot table by cell

Joined
Mar 16, 2011
Messages
3
Reaction score
0
Points
0
Hey,

I am a little rusty with vba these days.

I am trying to filter my pivot table by linking it to a cell on a seperate worksheet. This is what I have but I keep getting an error message. I am using excel 2007.

Code:
Sub Tourname()
'
' To filter PT by tour
'
'
    wrkshtpt.PivotTables("PivotTable1").PivotFields("Tour name").ClearAllFilters
    wrkshtpt.PivotTables("PivotTable1").PivotFields("Tour name").Sheets("wrkshtcmw").Range ("B1")
End Sub

Thanks!,

Brandon
 
Hey Brandon!

Sorry for the late reply here. You're on the right track, but you need to set your filter equal to something:

Code:
Sub Tourname()
'
' To filter PT by tour
'
'
wrkshtpt.PivotTables("PivotTable1").PivotFields("Tour name").ClearAllFilters
wrkshtpt.PivotTables("PivotTable1").PivotFields("Tour name").CurrentPage = Worksheets("wrkshtcmw").Range ("B1").Value
End Sub

Assuming that you're trying to set the page field, of course.

Hope things are well with you!
 
Thanks Ken!,

Things are going well. I am starting to get pretty busy.

I hope things are gong well with you!

Cheers,
 
Back
Top