Try this...
Sub a_filepath()
Dim fpath As String
Dim i As Long
fpath = "C:\Users\name\directory 1\"
For i = 2 To 5
Range("D" & i).Value = FindPath(fpath, Range("C" & i).Value)
Next i
End Sub
Function FindPath(ByVal strPath As String, ByVal strMatch As String) As String
Dim fsoSubfolder As Object
FindPath = "N\A" 'Default value if file not found
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
If InStr(1, strPath, strMatch, 1) > 0 Then
FindPath = strPath
Else
'Search sub folders
For Each fsoSubfolder In CreateObject("Scripting.FileSystemObject").GetFolder(strPath).SubFolders
FindPath = FindPath(fsoSubfolder.Path, strMatch)
If FindPath <> "N\A" Then Exit For
Next fsoSubfolder
End If
End Function
Bookmarks