Заранее большое спасибо!
- Код: Выделить всё
Sub папки()
On Error Resume Next
Dim fso, fsFolder, fsfolder2
Set fso = CreateObject("scripting.filesystemobject")
Set fsFolder = fso.getFolder(FolderName)
Set DestRange = Worksheets(2).Range("A1")
DestRange.CurrentRegion.ClearContents
For Each fsfolder2 In fsFolder.subfolders
Set NewLine = DestRange.Offset(DestRange.CurrentRegion.Rows.Count, 0)
NewLine.Offset(0, 0).Value = fsfolder2.Name
Next
Worksheets("СТАТИСТИКА").Cells(6, 3).Value = fsFolder.Size
Worksheets("СТАТИСТИКА").Cells(2, 2).Value = fsFolder.subfolders.Count
Worksheets("ПАПКИ").Cells(1, 1).delete Shift:=xlUp
Worksheets("ПАПКИ").Cells.EntireColumn.AutoFit
End Sub