Gruppe
Datei
Problem
Wie kann ich mir eine Liste aller Dateien erstellen lassen, deren Verzeichnisse in Spalte A einer Tabelle stehen?
StandardModule: basMain
Sub DateiListe()
Dim wks As Worksheet
Dim iRow As Integer, iCounter As Integer, iRowT As Integer
Application.ScreenUpdating = False
Set wks = ActiveSheet
Workbooks.Add 1
iRow = 1
Do Until IsEmpty(wks.Cells(iRow, 1))
Cells(1, iRow).Value = wks.Cells(iRow, 1).Value
iRowT = 1
With Application.FileSearch
.NewSearch
.LookIn = wks.Cells(iRow, 1).Value
.Execute
For iCounter = 1 To .FoundFiles.Count
iRowT = iRowT + 1
Cells(iRowT, iRow).Value = _
.FoundFiles(iCounter)
Next iCounter
End With
iRow = iRow + 1
Loop
Rows(1).Font.Bold = True
Columns.AutoFit
Application.ScreenUpdating = True
End Sub