How to List Recent Files with VBA

How to list recent files with VBA automatically and open the most recent file. This is required when we wish to perform actions like transferring data to the most recent file we have been working on. Watch the video:

Watch this video on YouTube.

Here;s the complete code to open the most recent file auotamically and the some code commented out to list all the recent used files in your worksheet:

Sub displayMostRecentFile()
Range(“A1”) = Application.RecentFiles(1).Name
Workbooks.Open Filename:=Range(“A1”)

‘Application.RecentFiles.Maximum = 5

‘For i = 1 To Application.RecentFiles.Count
‘Cells(i, 1) = Application.RecentFiles(i).Name
‘Next
End Sub

Further Reading:

Application.RecentFiles property (Excel)

A downloadable sample file for practice:

Published by

Dinesh Kumar Takyar

Welcome to exceltrainingvideos.com! My aim is to help you learn MS Excel including VBA. I always felt that a good way to learn something was to find solutions to problems in that domain. That is why I share these Excel videos with you. Mostly these are questions asked during my corporate training sessions. I've been training individuals and companies in computers since 1991. I did my B. Sc. (Vordiplom), M. Sc. (Diplom) and Ph.D. (Dr. rer. nat.) from Hamburg, Germany. The best thing about solving some of my visitor's questions is that I also gain new insights. For more Excel VBA solutions you may like to visit my YouTube channel: http://youtube.com/familycomputerclub For a structured Excel VBA training course online you can visit: https://www.youtube.com/excelvbaonline

One thought on “How to List Recent Files with VBA”

  1. Hi Sir
    Your tutorials have helped me a lot and I am sure it helped others like me around the world. I had this problem dealing with how to create a timesheet that has only Start: 7:50 Am Finish: 16:00 Break: 40 Minutes.
    Name Start Time FinishTime Break TotalhoursW
    Jason 7:50 AM 16:00 PM 40 Mnt =

    Thank you sir I would be really appreciative if helped on this one.

    Kind Regards
    Jason Dean

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.