treyabrown
New Member
- Joined
- May 23, 2014
- Messages
- 7
I am trying to perform a loop through a file folder and pull all of the file names and paste them in my range EXCEPT I want it to skip all files that have Zero Reading in the name. Any help?
In my code below I cannot get the If statement to skip all file names containing "Zero Reading" in the title.
Sub ListFiles()
ActiveWorkbook.Sheets("Comparison").Select
Range("NetworkFile").Select
F = Dir(Range("FilePath") & "*" & Range("FileFormat"))
Do While Len(F) > 0
If F = "*" & Range("ZeroReading") & "*" Then
Exit Do
End If
ActiveCell.Formula = F
ActiveCell.Offset(1, 0).Select
F = Dir()
Loop
Application.Calculate
End Sub
In my code below I cannot get the If statement to skip all file names containing "Zero Reading" in the title.
Sub ListFiles()
ActiveWorkbook.Sheets("Comparison").Select
Range("NetworkFile").Select
F = Dir(Range("FilePath") & "*" & Range("FileFormat"))
Do While Len(F) > 0
If F = "*" & Range("ZeroReading") & "*" Then
Exit Do
End If
ActiveCell.Formula = F
ActiveCell.Offset(1, 0).Select
F = Dir()
Loop
Application.Calculate
End Sub