As a preface, I tried to search for the solution to this for a while and was able to come up with some code, but it doesn't quite solve the issue.
Sub a_filepath()
Dim fpath As String
Dim filepath As String
fpath = "C:\Users\name\directory 1\"
filepath = Dir(fpath, vbDirectory)
Do Until filepath = ""
For i = 2 To 5
If InStr(1, filepath, Range("C" & i)) > 0 Then
Range("D" & i).Value = fpath & filepath
End If
Next i
filepath = Dir()
Loop
End Sub
The problem I'm having with this is that it doesn't go further into the folders within the specified folder. In other words if the directory was "C:\Users\name\directory 1\", and the folder was in "C:\Users\name\directory 1\directory 2\directory 3\folder", I'd like it to go in there and find it.
Is there any way to do this?
Bookmarks