View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Error handling best practices


I'd like to get some ideas on error handling best practices. I prefer to
handle the errors where they occur using something like this

Set myWS = Nothing
on error resume next
Set myWS = ActiveWorkbook.Worksheets("Sheetabc")
On Error goto 0
if not myWS is nothing then
'Do Stuff
end if

I've also seen On Error GoTo ErrHandler with the error handler at the end.
I've been trying to update a workbook that has the latter and I'm finding
it's a pain to find the errors without making other code changes. Ideas
folks?

Thanks,
Barb Reinhardt