@ PGCodeRider Спасибо, я изменил ваш код в соответствии со своими потребностями, и теперь он работает.Любой, кто заинтересован ("или также не нашел ничего в Google") под кодом:
Const dirPath As String = "C:\folderpath\..."
Sub RunIt()
Dim Rcell As Range
For Each Rcell In Intersect(Range("A:A"), ActiveSheet.UsedRange).Cells
If Not IsEmpty(Rcell) Then
If CheckIfFileExists(dirPath, Rcell.Value) Then
'whatever you want to happen when it finds a match
Debug.Print Rcell.Value & " was found"
End If
End If
Next Rcell
End Sub
Private Function CheckIfFileExists(srchDIR As String, MatchMember As String) As Boolean
Dim file As Variant
Dim length As Long
If Right(srchDIR, 1) <> "\" Then srchDIR = srchDIR & "\"
file = Dir(srchDIR)
While (file <> "")
length = Len(file)
For i = 1 To length
If Right(file, 1) <> "." Then
file = Left(file, length - 1)
length = Len(file)
Else
Exit For
End If
Next i
file = Left(file, length - 1)
'If InStr(1, file, MatchMember, vbTextCompare) > 0 Then
If file = MatchMember Then
CheckIfFileExists = True
Exit Function
End If
file = Dir
Wend
End Function