Select folder

Brief description:

Open dialog box to select desired folder

Full description:

Opens a dialog box to select the desired folder.

To use: Call the routine from a different macro or connect a control to the routine.

Save the output to the desired location by editing the code. Where it currently outputs to the debuging console, comment that line and use the line above to save the folder destination in the desired location.

Dialog box shown:

Option Explicit

Sub SelectFolder()
    ' Opens dialog box which allows a folder to be selected
    Dim FolderPath As String

    With Application.FileDialog(msoFileDialogFolderPicker)
        If (.Show = -1) Then
            FolderPath = .SelectedItems(1) & "\"
            Exit Sub
        End If
    End With
    If FolderPath <> "" Then
        'Sheet1.Range("A1") = FolderPath
        Debug.Print FolderPath
        Exit Sub
    End If
End Sub