ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter PivotTable Field by VBA (https://www.excelbanter.com/excel-programming/423152-filter-pivottable-field-vba.html)

Slim Slender[_2_]

Filter PivotTable Field by VBA
 
Does anyone know how to 'generalize' the following:

..PivotItems("1/18/2009").Visible = False
..PivotItems("1/22/2009").Visible = False

Can I replace them with something that says don't show anything
after a certain date or less than a certain age ,
like don't show if item (date) is greater than Today() - 7.?


Debra Dalgleish

Filter PivotTable Field by VBA
 
There's a sample file here that filters the pivot table based on dates
entered on the worksheet:

http://www.contextures.com/excelfiles.html

Under PivotTables, look for 'PT0022 - Filter Pivot Table for Date Range'

Slim Slender wrote:
Does anyone know how to 'generalize' the following:

.PivotItems("1/18/2009").Visible = False
.PivotItems("1/22/2009").Visible = False

Can I replace them with something that says don't show anything
after a certain date or less than a certain age ,
like don't show if item (date) is greater than Today() - 7.?



--
Debra Dalgleish
Contextures
www.contextures.com/tiptech.html
Blog: http://blog.contextures.com



All times are GMT +1. The time now is 12:21 AM.

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