I have global sales data in very large files, which I have to filter by country and product and then analysis. Since I will have to do this analysis again and again with different countries / product associations. I am trying to do this with macro.
What this macro does:
- Open source files with global data;
- Data filters;
- It copies it and pastes it into a workbook that contains the macro;
- Reconfigure and refresh the workbook;
- Saves a copy of the file in another folder.
The macro runs fine and the files are being saved, although I'm running in two steps 4 and 5:
- The pivot table is refreshing Is not a problem - this is another problem because it can be:
- All pivot tables in the saved copy are still referenced Original file
I copy without link I would like to fix both problems by generating the created file, but I would also like to do any bundids Ula, which shall be forced to link the file copy I own (it does not seem to work when their own work).
If you want to see it all, then I have a complete code, but because I suspect how I am saving this file, I will paste that piece on it. I know if you need to see the second part of the macro, any help will be appreciated for a long time, thanks
Save Function:.
Public updateAsCopy (as filepath string) slow updateStatus Boolean 'Check Alert = Current status of updateStatus = Application.DisplayAlerts' Alert Application.DisplayAlerts Close = false ThisWorkbook.Sheets. Copy 'Without a Macro' 'New Workbook Is Now Active Workbook' Control Sheet ActiveWorkbook.Sheets (1) .Delete 'Save Macro Delete New Workbook Creates Free Version and Close ActiveWorkbook.SaveAs File Name: FilePath, Fileformat : = 51 ActiveWorkbook.Close 'Back Call alert code (file path)
/ Div>
After the evolution of the solution, I did not find any cut on any more beautiful solution:
< Code> Public Sub SaveAsCopy (filePath String as String) Dim updateStatus as Boolean 'Check Current Status Alert updateStatus = Application.DisplayAlerts' Alert Application.DisplayAlerts Close = false' Hide Control Sheet ActiveWorkbook.Sheets (1) .Visible = False 'Macro free number Save and rename ActiveWorkbook.SaveAs file name: FrontPage, Fileformat: = 52 'ActiveWorkbook.Sheets (1) .Visible = True' Return to the original alert status. Application.DispellAllets = UpdateStatus and All
At the end of the original function I close the current file, open the original and loop through the new workbooks to remove macros.
Comments
Post a Comment