Need to add something to the end of an existing macro to delete a worksheet

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a macro that will clean up an Excel version of a Bill of
Materials that gets exported from another software (SQL) from our MRP
system. I would like to add something to the end of the macro to tell
it to delete the "sheet1" worksheet, because the macro I've created
automatically creates a new sheet 2 that I want to replace it. The
message box that automatically appears (for which I want the existing
macro to take care of and not have show up) says "Data may exist in the
sheet(s) selected for deletion. To permanently delete the data press
Delete." Any advice would certainly be appreciated
 
application.displayalerts = false
on error resume next
activeworkbook.worksheets("sheet1").delete
on error goto 0
application.displayalerts = true

The on error stuff is nice if Sheet1 may not exist.
 
Thanks so much... I wouldn't have come up with this in a million
years, because I'm rather new to this stuff. Worked like a charm,

Best Regards,

Steve
 
Back
Top