vbacoder
Active Member
- Joined
- Jul 7, 2007
- Messages
- 354
Hi everyone,
I am using a statement to step through a list of filenames in a list using the following syntax:
Occasionally, the filenames I add to the selection range do not appear in the source folder. When this happens, the macro throws up an error message and stops. If no match is found, I want it to automatically skip to the next filename in the list. I know there is a way to do this, I just do not know the syntax for achieving this.
This is how I think part of it is done, using the .Find statement:
If no match is found, the statement is False, and I then need to add another statement to tell the code to skip to the next in the list if the filename does not appear anywhere in the selection range/list.
I would be very grateful for any suggestions on this.
Many thanks,
vcoder
I am using a statement to step through a list of filenames in a list using the following syntax:
Code:
For Each filename In selection
.....
Next
Occasionally, the filenames I add to the selection range do not appear in the source folder. When this happens, the macro throws up an error message and stops. If no match is found, I want it to automatically skip to the next filename in the list. I know there is a way to do this, I just do not know the syntax for achieving this.
This is how I think part of it is done, using the .Find statement:
Code:
For Each filename In selection
Workbooks.Find filename: = "...blah blah .."
Next
If no match is found, the statement is False, and I then need to add another statement to tell the code to skip to the next in the list if the filename does not appear anywhere in the selection range/list.
I would be very grateful for any suggestions on this.
Many thanks,
vcoder