~Recent File~

A

andibevan

Hi All,

Is there a formula which can be used to display the name of the mos
recently editted file in a specific directory.

I have a macro which does this but need to try and find a formula t
use?

Any ideas?

Thanks

Andi
:confused
 
L

LanceB

You can create a user defined function, as an example:

Function findit()

Dim a As Date
Dim b As Variant

With Application.FileSearch
If .Execute() > 0 Then

For i = 1 To .FoundFiles.Count
If a < FileDateTime(.FoundFiles(i)) Then
a = FileDateTime(.FoundFiles(i))
b = .FoundFiles(i)
End If
Next i

findit = b

End If
End With

End Function

Placing =findit() in a cell will return the name of the file with the most
current date
 
M

Myrna Larson

If by "macro" you mean a VBA function, that is the only way. AFAIK, there are
no regular Excel worksheet functions that even read files names from a
directory, to say nothing of the the date & time modified. There is, of
course, an old XLM macro function that will retrieve the file names, but not
the times.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top