I have a sheet which is auto generated and I want to add pivot tables to it. The macros work fine individually but when I try to run all 3 macros in one go, the 3rd one will fail with an object-defined error no matter which order I run them in. Any ideas?
This fails on the addDisciplinaryPivot part of the btnMacros_Click sub. Changing the order the pivot tables are made has the same effect (the 3rd pivot table will fail), for example this:
Fails on addAttendancePivot. I've spent a day on this now and it's wasting too much time. I could write my own pivot table faster than fixing this problem.
The lines that fail are the ones that include ActiveWorkbook.PivotCaches.Add
Bookmarks