View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default error runtime 9: deleting a worksheet

You would get this error if test does not match the name of a sheet in the
activeworkbook. (could be a spelling error or a matter of extra spaces or
example)

--
Regards,
Tom Ogilvy


wrote in message
om...
Hello,
I wrote following code and sometimes I get an runtime error 9. I don't
really know when and why this error occurs. The value of test is never
empty.


On Error GoTo Marke
Application.DisplayAlerts = False
test = Worksheets("Länderansicht").Range("A" & i).Value
''''''''FEHLER'''''''''''''''''''''''''''''''''''' ''''''''''''''
Worksheets(test).Select ''''''''''HIER TRITT DER FEHLER AUF
'''''''FEHLER''''''''''''''''''''''''''''''''''''' ''''''''''''''
Worksheets("Länderansicht").Select
Worksheets("Länderansicht").Activate
Worksheets(test).Delete
Marke:
Application.DisplayAlerts = True


Tanks a lot,
Michael