VBA code to add new data to existing data model in excel RRS feed

  • Question

  • I'm working with an xlsx file that contains information for financials from 2017 and 2018. I was also provided with the xlsx file for financials from 2019. I need to combine the two files using a single macro, but I'm not sure what the VBA code should be. All Power Pivot Tables and Power View Reports have to reflect the new data after the user clicks on the macro button. Error control and protection is required. The current data provided includes 2017-2018 data. The next logical year should be 2019. The only file that should be allowed to be imported is the "Latest file" for the year immediately after the last successful import. This will prevent the same data from being imported multiple times or data years to be skipped. I need to develop appropriate VBA code that will halt the import process and provide an error message if the year is a duplicate or incorrect. I have to rely on the file contents, not the file names, to control the import year. 
    Friday, December 6, 2019 6:18 PM

All replies