I have a folder containing multiple CSV files and I have another folder containing an Excel workbook. I want to import all the CSV files from the workbook by the click of a button into seperate sheets (fx 3.csv will have sheetname "3" etc.) without having to specify which one to open. These CSV files are updated frequently, however not always on the same day. I want the import code to also update/overwrite whatever CSV files have been updated. I assume that this is implicitly done every time I import all the files.
The following code does the trick..well almost. The problem is whenever I click on the button it doesn't overwrite the existing sheets. It adds new sheets. Let's say I upload (for the very first time). The sheets inside the workbook are called city1.csv, city2.csv etc.. The second time I run the code, it has added another range of sheets city1, city2 etc. The third time city1(1), city2(2) etc.
How can I make the import code to overwrite every time I click on the button instead of adding new sheets once the first sheets have been added?
I assume the problem is in the "mybook.Worksheets(1).Copy after:="-part. Don't know how to let the workbook recognize existing sheets (while also being able to import the CSV files the first time)
Thx!
Bookmarks