Determine Last File Name In Directory

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,435
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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,197
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

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,435
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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,190,781
Messages
5,982,873
Members
439,803
Latest member
sushilneupane

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