On Error

  • Thread starter Thread starter TO
  • Start date Start date
T

TO

I have book where I open workbooks based on a filenames
contained in a column. When the file is opened code runs
and perfoms various operations. The next cell in the
column becoms the target filename and that file is opened
and data is extracted.

The problem I have is that the filenames in the column do
not always match the files in the destination folder.

If there is a filename but no actual file, I would like
to skip all the following code and go to the next cell
(new filename) and open etc. I tried using "On Error
GoTo". This works unless there are two consecutive "bad"
filenames.

Thanks in advance
 
To,

You should post the appropriate snippet of code. You should be looping, so
it ought not be a problem. But if you post your code, I am sure someone
will spot your error.

Regards,
Kevin
 
Instead of using error handling, just check if the file exist and put your
code inside and If ... End if Statement

if dir(cell.Value) <> "" then
' file was found, code to open and work with it


End if
 
Back
Top