PIVOT TABLE HIDE ITEM CODE HELP HELP

L

Legacy 55353

Guest
Hi,

I am having trouble writing 2 codes for 2 command buttons.

Code #1
The first code is to show only specific dates in a pivot table. I have a pivot table with dates from 1/1/04 to the current date. I need to turn on different date ranges every week. I.E. This week I need the dates from 12/10/05 to 12/18/05. I am looking for a code that will show only the dates including and between the dates of my range. Right now I have a begin date in cell A1 and an end date in cell A2. The pivot table item I am working with is called "Release Date" and I am looking for a code that will turn on the dates including and between the date in cell A1 and the date in cell A2. I would need to use this code for multiple pivot tables. I was using a call function but cannot figure out the right code.


Code #2 is probably more complicated.
Now I am working with 2 pivot table Items, i.e. "Release Date" and "Receipt Date." Both the release date and receipt date fields have a blank date "01/01/00" along with all the dates from 1/1/04.
I need this code to manipulate BOTH the release and receipt date fields.

FOR THE RELEASE DATE: I need the code to turn on only the blank date and anything after a certain date (usually the last friday). SO for today 12/28/05: I need only 01/01/00 and any date after 12/23/05 turned on.

FOR THE RECEIPT DATE: I need the code to turn on all the dates except the "01/01/00" and the days after 12/23/05 Friday. SO for today the dates that would be turned on would be all the dates from 01/01/04 to 12/23/05.

Again I am using this code for multiple pivots.

I can email you the file. I really appreciate any help. I have been trying to figure out the code for months. I can't find anything on the internet. Thank you. You can email me guitarfish222 at hotmail dot com and I can send you the file. Thanks again.
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

XLGibbs

Well-known Member
Joined
Feb 25, 2005
Messages
2,446
You can emaiil me the file if you wish, I work with pivot tables frequently and can help

As far as the manipulation, you can record a macro which shows you the syntax for deselecting values within a data set from the drop down, or hide/unhide items from the page selection options.

Assuming your dates are contained in a date field, this should not be too problematic...if the dates are column headers themselves, then it would be amatter of showing or not showing the field itself...again, recording a macro can show you the syntax.

the code can only be re-used for multiple tables by referring to the table name as a variable, which can be identified any number of ways within the code, either using input boxes, checking the active sheet for pivot tables, or by referring to the name of the pivot table directly.

If you like, email me the file and I can see what I can do.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,911
Messages
5,575,001
Members
412,633
Latest member
simon_elvin
Top