Hi,
I have the following code which check if the file exists in the specified folder. However, the code macro does run slow.
Is there anyway to suggest replacing the code with the an alternative please?
Regards
Sub Check_workbook()
Dim myFolder As String
Dim myFileName As String
Dim myRange As Range
Dim myCell As Range
Set myRange = Range("O2:O1472")
myFolder = "S:\Other\Data"
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
I have the following code which check if the file exists in the specified folder. However, the code macro does run slow.
Is there anyway to suggest replacing the code with the an alternative please?
Regards
Sub Check_workbook()
Dim myFolder As String
Dim myFileName As String
Dim myRange As Range
Dim myCell As Range
Set myRange = Range("O2:O1472")
myFolder = "S:\Other\Data"
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