Hello!
I’d like a user to select the month they want to view (the example picks MAR06) from a data validation list I created on the “Input Month” worksheet. Based on the month they pick, I’d like the macro to UNHIDE and then HIDE certain months. I have a few columns to the right of the selected month that have formulas which will show the months that need to be HIDDEN in the pivot table located on the next worksheet. It becomes a bit trickier, because it’s not just one month that needs to remain UNHIDDED, as the pivot table will need to show MAR06 and MAR05, as I would like to show March of 2006 compared to March of 2005. I thought since the pivot table will be used to view any of the months, the macro would need to first UNHIDE all months hidden, and then HIDE the months showing in E5 thru E28 located in the “Input Month” worksheet in my example. Of course, if someone has a better idea that works faster, I’m totally up for it. To complicate it a bit further, I’d like the macro to then do the same for the 2nd pivot table (ALSO located on the “pivot table” worksheet) which will show the Year-to-Date amounts, however this part of the macro would UNHIDE all months hidden, and then HIDE the months showing in F5 thru F28, also located in the “Input Month” worksheet. To top it all off, I plan on having about 15 or more worksheets in the file, each with one or more pivot tables (month and/or both month & ytd pivot tables), of which I’d like the macro to loop through all of them and update the UNHIDE/HIDE functions. Any one with some code out there that may do this already, or have any suggestions, I would greatly appreciate it!!
I’ve attached my example for a reference (please note that I left my current attempts at recording and tweeking the code off of the file as to avoid embarrassment… they didn’t work anyway?!?!?)
Thanks for the help!!!
LJM
-
Macro to Hide/Unhide Pivot Table Items from a list (Excel 2002)
- This topic has 2 replies, 2 voices, and was last updated 19 years ago.
AuthorViewing 0 reply threadsAuthorViewing 0 reply threads