Thread: Is Nothing
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John[_88_] John[_88_] is offline
external usenet poster
 
Posts: 205
Default Is Nothing

Hi there,

I'm always getting into trouble with the Is Nothing statement. At the
moment, I want to delete a specific sheet if it exists prior to adding
another of the same name, so:

If Not wkb.Sheets("TempSheet") Is Nothing Then
wkb.Sheets("TempSheet").Delete
End If

I'm getting a subscript out of range error on the first line (above) and a
err code of 9 (PS can anyone point me to a list of error codes?)

Can anyone tell me what I'm doing wrong?

Thanks

John