Quote:
Originally Posted by AllekieF
Why are you using VBA for this? This will be much, much quicker and easier with Power Query (get & transform)
|
The sheet in workbooks the info is read from doesn't have properly designed table (neither standard or defined one). Instead there are regions on sheet, which can be handled as different tables, but not designed as ones (some regions have data, but not headers, some have header row, but not all headers, placement of regions and the number of data rows in them can vary, there may be empty rows in regions, the number of columns and their placement in region may differ, etc. The script opens the file, analyzes it to determine, can it read wanted data from there or not (essentially by searching for certain strings in some single row, which are defined as column headers), and when it can, then reads this data. Also comments for files or data rows are created, when there was a reason the data couldn't be read, or when some info was missing.
As a result, a table with info from all ~1000 files in folder (from 1 to up over 100 rows per file) is created, plus another one where all problems with files, or with data read from them, are listed.
As you can see, no way this can be done using a query! And the structure of those files is not controlled by users of my app - they are mailed from 3rd party.
Btw. Currently I'm designing the app, so that the info will be updated only for new files or ones edited after previous run. So after inital run, next updates will be much faster.