Get Date Last Modified of a specified folder return as date in a specific cell

handysmurf

Board Regular
Joined
Jan 17, 2015
Messages
89
Office Version
  1. 365
Platform
  1. Windows
I have searched and can't find this. If you know of a thread that answers this please do direct me there.

I need to return the date last modified of a specific folder in a cell. I would also note that there are multiple folders I need to do this for, return in their own cells.


PS: If there is a basic section or something I can study to start to learn this stuff that would be great. I hate that I'm not learning how to, I'm just cut and pasting stuff that others give me.

TIA
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
If you are looking for a custom function to use in a cell formula, you could try this. Put this in a Module and use the formula below.
VBA Code:
Public Function GetLastModified(folderPath As String) As Date
    Dim fs As Object
    Dim f As Object
    
    Set fs = CreateObject("Scripting.FileSystemObject")
    
    On Error Resume Next
    Set f = fs.GetFolder(folderPath)
    If Not f Is Nothing Then
        GetLastModified = f.DateLastModified
    End If
End Function
Book1
AB
1C:\Users\Public\Documents2/8/22 7:48 PM
Sheet1
Cell Formulas
RangeFormula
B1B1=GetLastModified(A1)

For research, look up FileSystemObject for VBA.
 
Upvote 0
Solution
It does not appear to be updating?

I saved, closed, and reopened. Did not update.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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