I've been working on a code and can't seem to find a way to make this work,
here it goes: I'll have column A with value that I will select cell to search a match on our network folder/subfolder if it exist or not then on next column if the value exist on the folder it will write File Exist
.
My code that currently work only search on Main selected Folder only and not including subfolder.
Sub Search_myFolder_Network()
Dim myFolder As String
Dim myFileName As String
Dim myRange As Range
Dim myCell As Range
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select a Folder"
.InitialFileName = Application.DefaultFilePath & "\"
If .Show = 0 Then Exit Sub
myFolder = .SelectedItems(1)
End With
Set myRange = Selection
For Each myCell In myRange
myFileName = myCell.Value
If Dir(myFolder & "\" & "*" & myFileName & "*") = "" Then
myCell.Offset(0, 1) = "File Doesn't Exists."
Else
myCell.Offset(0, 1) = "File Exists"
End If
Next myCell
End Sub