View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default An error on the error :)

On Error Resume Next
Sheets("EMPLOYEE").Delete
Sheets("ALLSALES").Delete
On Error GoTo 0

Regards

Trevor


"Teggaman" wrote in message
om...
try this instead

On Error GoTo 777
Sheets("EMPLOYEE").Select
ActiveWindow.SelectedSheets.Delete
777:
On Error GoTo 0
on error goto end_error
end_error
Sheets("ALLSALES").Select
ActiveWindow.SelectedSheets.Delete
goto end_error

888:
resume 777

end_error:

end sub











"Paul" wrote in message

...
I want VB to delete two sheets if they exist.

In the following example, neither sheet exists. VB handles
the missing EMPLOYEE fine, but then crashes when it hits
the missing ALLSALES. Why?

On Error GoTo 777
Sheets("EMPLOYEE").Select
ActiveWindow.SelectedSheets.Delete
777:
On Error GoTo 0
On Error GoTo 888
Sheets("ALLSALES").Select
ActiveWindow.SelectedSheets.Delete
888:
On Error GoTo 0

TIA
Paul