Hello All,
have Sheet("List") with an autofilter and sheet("Table") with pivot table. How do I base the pivottable on the filtered (visible) items from "List"?
I use this code so far but:
Code breaks on the pivot table is refreshed with "Reference not Valid"![]()
Dim FilteredRange As Range Dim MyFilteredRange As Range Set FilteredRange = Sheet1.AutoFilter.Range. _ SpecialCells(xlCellTypeVisible) MsgBox FilteredRange.Address, vbOKOnly, "Address" Set MyFilteredRange = Sheets("List").Range(FilteredRange.Address) 'MsgBox MyFilteredRange.Address ThisWorkbook.Names("MyTable").RefersTo = MyFilteredRange.Address Dim Worksheet As Worksheet Set Worksheet = ThisWorkbook.Worksheets("Table") For Each PivotTable In Worksheet.PivotTables With PivotTable .RefreshTable End With Next PivotTable
so I check the name, and the Refers to field is filled up with this
How do I construct a proper range reference based on the visual cells?![]()
="$A$5:$N$5,$A$14:$N$15,$A$25:$N$25,$A$31:$N$31,$A$35:$N$35"











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks