View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default If named sheet exists then delete it

I am creating a new sheet in a macro and then renaming it to Test with
the following lines:

Sheets.Add
ActiveSheet.Name = "Test"

However, there might already be a sheet called Test in the workbook
from an earlier (failed) run of the macro. How can I detect if that
sheet exists and delete it if it does exist before the above lines of
code?

Many thanks,

Pete