Hi,
I have the below macro. It asks to select a folder and makes a list of folders.
I need a changes. I need to make a list folders in the selected folder. Help me.
Regards,
Srinivasa Rao
I have the below macro. It asks to select a folder and makes a list of folders.
I need a changes. I need to make a list folders in the selected folder. Help me.
Code:
Sub GetFileList()Dim folderPath As String, nextFile As String, i As Long
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show Then
Range("A:C").ClearContents
Range("A1") = "Path:"
folderPath = .SelectedItems(1)
Range("B1") = folderPath
nextFile = Dir(folderPath & "\*.*")
i = 3
Do While nextFile <> ""
Cells(i, "A") = nextFile
i = i + 1
nextFile = Dir
Loop
Columns(1).EntireColumn.AutoFit
Else
MsgBox "No folder selected"
End If
End With
End Sub
Regards,
Srinivasa Rao