View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
steve_doc steve_doc is offline
external usenet poster
 
Posts: 140
Default Check if named range exists!

Hi all

trying to find a solution to the following small problem. I need to check to
see if a named range exists, if it does I then need to delete it, if it
doesnt I need to exit sub
The following code is what I have, which works if the Named range exists,
however causes a break and run time error 1004 if the named range does not
exist.

If ActiveWorkbook.Names("Renewal_Report") Is Nothing Then
Exit Sub
Else
ActiveWorkbook.Names("Renewal_Report").Delete
Selection.AutoFilter

End If

Have I used the correct syntax?