I have a macro-enabled Excel file with many tabs on it. Four of the tabs contain Pivot tables that pull their data from one other tab. I have VB code that exports the five tabs to a specific location as an xlsx file. I make sure that the data tab is added first, then the four pivot tabs are added after. Below is the code:
The new file is created and saved where I want it. The problem is that the pivot tables are still pulling their data from the macro-enabled file and not from the data tab in the new xlsx file. Does anyone know how I can get the pivot tables to automatically pull the data from the file that is in the worksheet they're in?
Thanks
Rich (BB code):
Rich (BB code):
Rich (BB code):
Rich (BB code):
Sub SaveCopyAs_Without_MacrosArrayFinal()
Sheets(Array("Data", "Pivot1", "Pivot2, "Pivot3", "Pivot4")).Copy
ActiveWorkbook.SaveAs Filename:="S:\Location\Archive\On Order " & Format(Date, "YYYY" & "MM" & "DD") & ".xlsx", FileFormat:=51
End Sub
The new file is created and saved where I want it. The problem is that the pivot tables are still pulling their data from the macro-enabled file and not from the data tab in the new xlsx file. Does anyone know how I can get the pivot tables to automatically pull the data from the file that is in the worksheet they're in?
Thanks