Execute Excel Macro Repeatedly for all csv files in a folder

Zachary69

New Member
Joined
Jun 27, 2021
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,

Every week I will have to download about 600 csv files containing data from different sensors. Currently, for each of this csv files I have written a macro to do analysis and it generally takes less then 10 seconds for each one. I have written the macro such that at the end of the execution the result (in one row) will be pre copied, then I would have to paste it in another master listing manually and lastly I will go back to the analysis macro file and clear the existing query (with a simple macro I wrote). I will repeat this process for another 599 times.

I have very little experience in coding, but having that analysis macro was a small achievement for me. So I would like to ask if it is possible for me to loop my analysis macro automatically without me having to execute the analysis macro and paste it to my master listing for 600 times.

So the loop process would be

Execute Loop Macro > Analysis macro will query first csv file from data folder > Result in analysis excel file A & precopied > Paste in master listing excel file B > Clear the query in analysis file A >Analysis macro will query the next csv file from data folder ... & it will loop until all the csv file in the data folder has been completed

Any guidance provided here will be very much appreciated.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
2,020
Office Version
  1. 365
Platform
  1. Windows
Yes, it is possible. I've done this a 1,000 times or more. This would be a back and forth process. I need your macro posted. Also, the format of your final data and a look at your data files.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,783
Messages
5,766,437
Members
425,354
Latest member
kshivanand21

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top