What's up? This is my first post so I'd like to start off by saying hi. I am a noob, but the bright side is I'm not one of those annoying ones who is too lazy to at least attempt to figure things out the hard way on my own. Anyway so I just started educating myself regarding macros the other day. I've learned a lot of things that have allowed me to accomplish about 70-80% of what I was hoping to, but I've hit a snag and need some help and I've come here as a last resort as I'm having troubles finding the answer on my own.
So here's my dilemma... I can't keep up with the level of reports I need to generate bc of the quick turnaround time required at my job. I'm basically trying to create a macro that does most of my work for me. What that entails is creating a worksheet with many tabs, each of those tabs has 3 pivot tables and each of those pivot tables have a different set of filters applied to them. Don't ask why I need so many tables across so many tabs etc etc bc I have to have it sorted like that for my job. Now there are literally hundreds of pivot tables that I usually go through one by one and apply all the filters to. As you can imagine, this takes forever. So I tried to make a macro that does everything from the beginning for me. Creates the pivot tables from the raw data, copy the pivots across all the tabs, and then go through all the tabs and apply all the filters.
I had trouble creating all that so I made a dumbed down version... this is where I'm at now... I have a template where all I need to do is paste copies of my pivot table into all my slides. Once pasted I run my macro and the macro goes through each slide and applies the different filters. Now I recorded myself doing this, reloaded the document, and ran the macro and it worked successfully so I thought woohoo! I did it. Then next day I attempt to run it on a new set of data... it doesn't work. Basically from my understanding whats going on is that the script is looking for that exact same pivot table from which it was recorded. In the debug it identified it as "pivot table 29" with this new pivot table containing new data it was recording it as "pivot table 61". so obviously this macro isn't doing what I had hoped as it's treating every pivot table pasted into the template as a unique pivot table that it doesn't recognize, it only runs successfully with the original pivot table used when I recorded the macro. Now these pivot tables always have the same parameters every time. The only thing that changes in it is the raw data, just numbers. So how do I get this macro to run regardless of what pivot table I paste into my template? I need it to treat/identify every pivot table the same so regardless of the info in the pivot table i paste in the macro still runs.
So in a nut shell..
What I'm trying to accomplish: I have a template. I have a pivot table that I create daily. Same data, just numbers change. Each day I paste the latest pivot table into all my slides and run the macro to go through all the slides and apply the filters.
Problem: Pasting any other pivot table into the template other than the original and the macro fails. In case any of you are wondering... yes. Everything is being done exactly the same as when the macro was run successfully. Pivot table placement, starting cell, etc.
I saw the sticky thread for all the literature to read, it's not that I don't want to go through it, it's that the list is f--ing long, lol and I'm so busy cranking out these reports I just don't have the time to go through all of that to look for this one specific solution. So I was hoping this is something that is a relatively easy solution and someone could just give me a nudge in the right direction if not answer it outright.
UPDATE: I learned pivots could be refreshed... who knew. Makes the solution a breeze.
Bookmarks