Hi all - hope you can help me as my boss is killing me over this!
I am having a lot of trouble with pivot tables in Excel 2007 VBA. I am trying to create pivot tables using macros (connected to buttons the user can press to create the pivot table) - please don't ask why, but i need to do this!!!
I used the record fuction in excel 2007 to produce macro code which will produce the required pivot tables when the user presses a button.
Unfortuanately the coding seems to work fine when i have one pivot table in a file but breaks down if i record code to produce another pivot table.
I have attached some code below (which was produced by the record function) and is intended to produce 2 seperate pivot tables (the macro submacro2 produces the 1st pivot table and the macro submacro4 lower down the page produces the 2nd pivot table). I have also indicated the point in sub 4 where the code breaks down - basically submacro4 just doesnt run!
I hope you guys can help me and suggest corrections to the code in sub4 so that I can produce the required 2nd pivot table (and perhaps more besides!)