I am trying to find an answer in code for the following problem. I have written the following macro to open around 1000 excel files and extract the required information. The excel files are saved in a folder. The macro opens the files in an alphabetical order. The problem that I have is that I extracted the individual excel files from different zip folders. I would like to let the macro open the excel files not in an alphabetical order, but by the modification date, meaning the order I unzipped the zip folder in the first place. This is required because i need to work with the data in the next steps.
Sub CalcSumms()
    
    ' Leere Zeile in A2 einfügen
    
    Dim Pfad, Dateiname
    Pfad = "D:\Rene\Rohdaten\"
    Dateiname = Dir(Pfad & "*.xlsx")
    
    Application.ScreenUpdating = False
    Do While Dateiname <> ""
        Dim Gemeinde As String
        Dim Arbeitsort As String
        Dim Wohnort As String
            
        Workbooks.Open Pfad & Dateiname
        Sheets("Impressum").Select
        Range("C10").Activate
        Gemeinde = Selection.Value
        
        Sheets("Daten").Select
        Range("D10").Activate
        Arbeitsort = Selection.Value
        
        Sheets("Daten").Select
        Range("D23").Activate
        Wohnort = Selection.Value
        
        ActiveWindow.Close
            
        Range("A2").Cells.Value = Gemeinde
        Range("B2").Cells.Value = Arbeitsort
        Range("C2").Cells.Value = Wohnort
    
        Rows("2:2").Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Dateiname = Dir()
    Loop
End Sub
 
    