tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
I want to loop through the files in a folder, select only one that is NOT Thisworkbook, do something, then exit the loop.
However, the code above doesn't quite work.
How can I amend it?
Thanks
Code:
Dim SelectedFile As String
SelectedFile = Dir(PathName:="C:\MyFolder\")
Do Until SelectedFile <> ThisWorkbook.Name
If SelectedFile <> ThisWorkbook.Name Then
' do something
End If
SelectedFile = Dir
Loop
However, the code above doesn't quite work.
How can I amend it?
Thanks