I’m trying to search a networked drive for files including two keywords. When found, I need them to return the last modified date of said file to the same row one of the keywords was pulled from.
I’ve found something that is similar to what I need, but it doesn’t search for specific keywords.
Sub GetFilesDetails() ' in column G= Date Last Modified Dim objFSO As Scripting.FileSystemObject Dim myFolder As Scripting.Folder Dim myFile As Scripting.File Dim R as Long Set objFSO = CreateObject("Scripting.FileSystemObject") Set myFolder = objFSO.GetFolder(“S:\”) Application.ScreenUpdating = False For Each myFile In myFolder.Files ThisWorkbook.Sheets("Sheet1").Cells(R, 7).Value = myFile.DateLastModified R = R + 1 Next myFile Application.ScreenUpdating = True MsgBox "Updated" End Sub
I need keyword 1 to be “Proof” and keyword 2 to be variable based on the column B value. So starting at row 4, Keyword “Proof” and (B4) are the search terms to find the most recent file, and return the last modified date of the file into (G4). From there continue through the rows performing the same task, but skip any row with a blank B cell.
Any help is greatly appreciated!
Leave an answer