Opening most recent files

tobermory

New Member
Joined
Jun 4, 2012
Messages
46
This is probably impossible, but I'll ask it anyway. Is there a way to open, say, the 10 most recently modified spreadsheets in a particular folder? At my place of work, a new spreadsheet appears every 15 minutes in a specific folder with figures etc related to my job. In a super ideal world, I could copy and paste these figures from the 10 most recent files into a master spreadsheet, so I can monitor relevant fluctuations/changes etc. A long shot, but any help would be gratefully appreciated!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Here is an idea, run some Scripting code to list all the files into a spreadsheet which lists workbook name path and date modified then you could run another code to sort the list into date time order then use the top 10 entries to run the process you need it to.

Code for the first part is shown below:

Sub ListMyFilesinFolder()
'You need to set the Reference to use Microsoft Scripting Runtime
'Select the Tools menu and References
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder
Dim FileName As Scripting.File
'Change the file path to your folder location
SourceFolderName = "C:\Excel"
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
Range("A1:B1") = Array("text file", "Date Last Modified")
i = 2
For Each FileName In SourceFolder.Files
Cells(i, 1) = FileName.Name
Cells(i, 2) = FileName.DateLastModified
i = i + 1
Next FileName
Set FSO = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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
Back
Top