Gruppe
Datei
Problem
Die in Spalte B benannten Dateien (die Suffix *.jpg wird automatisch angefügt) sollen in einem vorgegebenen Verzeichnis gesucht werden.
StandardModule: basMain
Sub DateienFinden()
Dim iRow As Integer, iRowL As Integer
Dim sPathS As String, sPathT As String
Dim sFileS As String, sFileT As String
sPathS = Range("B2").Value
sPathT = Range("C2").Value
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 2 To iRowL
sFileS = sPathS & "\" & Cells(iRow, 1).Value & ".jpg"
sFileT = sPathT & "\" & Cells(iRow, 1).Value & ".jpg"
If Dir(sFileS) = "" Then
Cells(iRow, 1).Interior.ColorIndex = 6
Else
Name sFileS As sFileT
End If
Next iRow
End Sub