Determine Last File Name In Directory

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Is there a method of returning the filename of the last file in a particular drive's directory?
I have a directory containing .xls files in ascending order all with the same date formatting dd-mmm-yy.xls.
I wish to be able to have displayed the last file in that date, ie. the latest file.

Jenn
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I'd expect windows to sort these primarily on the dd portion, in other words 15-mar-09 would appear before 17-jan-09. That said, is the filename made up of the date only, or are there any other elements?
 
Upvote 0
Hmmm ... that is a good point.
Perhaps I should save the filename differently, maybe by serial number representing that date? (eg. 15-Oct-08.xls = 39736.xls) . I'm assuming that a serial number would be unique.

With that, could I find the last file?

Jenn
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

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