ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Table - filter by a cell reference (https://www.excelbanter.com/excel-programming/383184-re-pivot-table-filter-cell-reference.html)

Jeff S[_2_]

Pivot Table - filter by a cell reference
 
Hmm. Also, try using a string value instead of a range.

Dim strTitleSelection As String
strTitleSelection = Worksheets("Control Sheet").Range("JnlCode").Value
ActiveSheet.PivotTables("PivotTable3").PivotFields ("Title #2").CurrentPage =
strTitleSelection

Hope that helps,
-jeff


"Matthew Balch" wrote:

Hi,

I am having trouble with some VB where I want to filter a pivot table based
upo na cell value.

Here's the problem bit ofVB I have:-


Dim TitleSelection As Range
Set TitleSelection = Worksheets("Control Sheet").Range("JnlCode")

ActiveSheet.PivotTables("PivotTable3").PivotFields ("Title
#2").CurrentPage =
TitleSelection

I.e. where I have = TitleSelection doesn't work.

Thanks in advance
Matt






All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com