Here's a list of what I've pull out using a modified version of the 3rd example on this page [ link ]
Sub Iterate_Folders() Dim ctr As Integer ctr = 1 Path = "C:\StuffTest" FirstDir = Dir(Path, vbDirectory) Do Until FirstDir = "" If (GetAttr(Path & FirstDir) And vbDirectory) = vbDirectory Then ActiveSheet.Cells(ctr, 1).Value = Path & FirstDir ctr = ctr + 1 End If FirstDir = Dir() Loop End Sub
Results - pulling out filename, modified date, difference between modified date and previous business date as double , and previous business date as double.
Is there a smarter way to select only the most recent file where the modified date is NOT today, but the MAX date from that range? ( highlighted greeny-yellow in example)
I've tried loading the dates into an array and sorting, and casting both the modified date and previous business dates as doubles to find the difference , but I think I'm probably doing it in the most long winded way.
I may be going about this in a more complicated than necessary fashion - since implementing a scripted save, I am saving the date and time within the filename, so I *could* use that instead - it's just trying to get a reliable logic where it'll still capture the most recent reports ( run for prior 2 business days or more ) if the user had forgotten to run it for a week/month.