Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 "TO" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
on error resume next
"TO" wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- Regards, Tom Ogilvy "TO" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Error: "Excel encountered an error and had to remove some formatti | Excel Discussion (Misc queries) | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) |