Hey guys, I need your help (again). I've recorded a macro to create a pivot table. I have a filter to the pivot table referring to "Division", the value of which refers to the contents of a cell on another workbook.
I've declared the contents as the following:
Division = Workbooks("Macro.xls").Sheets("Macro").Range("P7").Value
The line referring to the pivot table filter is the following:
ActiveSheet.PivotTables("PivotTable1").PivotFields("Division").CurrentPage = Division
The macro runs on one sub program that calls on another before it ends. The sub program that is called changes the filter back to what "Division" is because before it is called, it is changed to something else (i.e. I believe it is "All"). Initially, this process did not work because I thought that I'd need to declare "Division", again, in the macro that is called, and not just in the main. When I did that, I get a totally different error that ruins the whole pivot table.
What I was wondering is if there's an easier way of doing all this that's error-free.
Thanks guys!
I've declared the contents as the following:
Division = Workbooks("Macro.xls").Sheets("Macro").Range("P7").Value
The line referring to the pivot table filter is the following:
ActiveSheet.PivotTables("PivotTable1").PivotFields("Division").CurrentPage = Division
The macro runs on one sub program that calls on another before it ends. The sub program that is called changes the filter back to what "Division" is because before it is called, it is changed to something else (i.e. I believe it is "All"). Initially, this process did not work because I thought that I'd need to declare "Division", again, in the macro that is called, and not just in the main. When I did that, I get a totally different error that ruins the whole pivot table.
What I was wondering is if there's an easier way of doing all this that's error-free.
Thanks guys!