LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Error Handling then continue running

I've having some trouble understanding how to do this Error Handling thing.
Any assistance that's offered is greatly appreciated! My coding is at the
end.

The macro is opening a series of files, manipulating them, then resaving
them with a new name. The file names and manipulations are all listed in a
spreadsheet; the macro pulls one row of information, does its thing, then
moves on to the next row until it reaches its stop command.

Where I'm having trouble with the error handling is getting the macro to
continue on its way after an error (if I understand correctly what's going
on, it actually is continuing on its way, but then stops upon reaching a
second row with an error)

My goal is to have any errors put a message in a cell of the offending row,
rather than a pop-up message. There's actually a couple loops in the macro,
my thought is that I can put in several "on error goto" err_handler1,
err_handler2, etc., and have each err_handler populate a different message.
Depending on the step where the error occurs, I can then populate that cell
with a message that instructs the user what correction is necessary.

So here's the coding I was using on the first loop. Thanks in advance for
any help!

Do Until Grow = NextRow

Windows("Personal.xls").Activate
Sheets("Info Delivery").Activate

If IsEmpty(Cells(Grow, 28)) = True Then GFolder = Cells(Grow, 27)
Else GFolder = Cells(Grow, 27) & "\" & Cells(Grow, 28)
ChDir SourcePath & GFolder

If Cells(Grow, 41) = "Y" Then
Application.EnableEvents = False

On Error GoTo Err_Hdler1
Workbooks.Open Filename:=SourcePath & GFolder & "\" &
Cells(Grow, 33)
Application.EnableEvents = True

End If

Err_Hdler1:
Select Case Err.Number
Case Is = 1004
Range("F" & SummaryRow) = "File Not Found"
Case Else
Range("F" & SummaryRow) = "Unknown Error"
End Select

SummaryRow = SummaryRow + 1
Grow = Grow + 1
Loop


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continue running macro until last line of data. Steve Excel Programming 1 November 24th 08 07:56 AM
Error handling error # 1004 Run-time error [email protected] Excel Programming 3 May 20th 08 02:23 PM
How to continue macro if there is an error value msdrolf Excel Programming 1 November 2nd 06 07:23 PM
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"