I am a PhD student and a, looking to create a 'master sheet' that has hyperlinks to all my files in my results folder; i can do this on the first level but i cannot get it to work for all the files in the subsequent subfolders, total depth is at most 5 subfolders from the main folder.

the code i have found and am using at the moment is:

Option Explicit

Sub HyperlinkDirectory()
'Author: Jerry Beaucaire, ExcelForum.com
'Date: 10/8/2010
'Summary: User selects a folder and file type, macro returns
' a complete listing of all files matching that type
' with a hyperlink to the file for ease of opening
Dim fPath As String
Dim fType As String
Dim fname As String
Dim NR As Long
Dim AddLinks As Boolean

'Select folder
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.InitialFileName = "C:\2009\"
.Show
If .SelectedItems.Count > 0 Then
fPath = .SelectedItems(1) & "\"
Else
Exit Sub
End If
End With

'Types of files
fType = Application.InputBox("What kind of files? Type the file extension to collect" _
& vbLf & vbLf & "(Example: pdf, doc, txt, xls, *)", "File Type", "pdf", Type:=2)
If fType = "False" Then Exit Sub

'Option to create hyperlinks
AddLinks = MsgBox("Add hyperlinks to the file listing?", vbYesNo) = vbYes

'Create report
Application.ScreenUpdating = False
NR = 5
With Sheets("Sheet1")
.Range("A:C").Clear
.[A1] = "Directory"
.[B1] = fPath
.[A2] = "File type"
.[B2] = fType
.[A4] = "File"
.[B4] = "Modified"

fname = Dir(fPath & "*." & fType)

Do While Len(fname) > 0
'filename
.Range("A" & NR) = fname
'modified
.Range("B" & NR) = FileDateTime(fPath & fname)
'hyperlink
If AddLinks Then .Hyperlinks.Add Anchor:=Range("A" & NR), _
Address:=fPath & fname, _
TextToDisplay:=fPath & fname
'set for next entry
NR = NR + 1
fname = Dir
Loop

.Range("A:B").Columns.AutoFit
End With

Application.ScreenUpdating = True
End Sub

this was very helpfully provided by Jerry Beaucaire