If I stop the code after the query refresh, then run through the pivot cache refresh, it will refresh correctly. If I don't stop the code, it will not update the pivot cache.
So my next question is this - is there a way to stop the execution, then start it again automatically? (Pausing the code doesn't work. End Sub doesn't work. It has to be a stop in the execution.)
I would upload a sample of the spreadsheet, but I don't think it'll work due to the MS Query connection. Theoretically the code is sound. The user inputs "start date" and "end date", then the query pulls only the production information for the date range indicated. The pivot table should then update to reflect what the query has pulled. But still, the pivot table refresh is lagging by one entry. It's like it's getting held up in the cache. Everything I have read says that the pivotcache.refresh should automatically refresh the pivot table with 'current' data. I've tried every code I can find or think of. What am I doing wrong?
Here is my complete code.
Again, if I put a "stop" in after the refresh all, everything will update. If I don't, the pivot table refreshes according to the previous entry instead of the current entry. I am ready to pull my hair out. Trust.