Hello,
I am a beginner working with VBA. Wondering if it is possible to have files within a designated folder open in chronological order (by date).
I am incorporating the FileDialogFolderPicker for the following sequence:
- I select the folder path. Each folder contains files for each day of the month, and they are number accordingly: 20150101, 20150102, 20150103, etc.
- I click a button, the prompt comes up to select a folder, I select the folder, then the macro opens each file, copies a specified range of data, pastes that data into a sheet in a different designated workbook, then closes the workbook it just opened. It does this sequence for each file one by one, so that a file is closed before the next one is opened.
- The macro works smoothly. The data is pasted starting in the first row of the worksheet, and going down. The only issue is that the data that is copied and pasted into the specified sheet is not pasted in chronological order. The "data" that I am referring to are tables - tables of data that are all being pasted into one sheet. Example: there is a table for July 1 2014, July 2 2014, July 3 2014, etc., and each table is 10 rows thick, and 10 rows long.
All i need is for the tables of data to appear in order by date (within the sheet where I am consolidating them). I have not been able to find specific code that will execute this in order.
Thank you!!!
- J
Bookmarks