Confirm Delete in a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a macro that I am using, I need to delete a sheet. When I record the macro and then replay it, it brings up the confirmation dialog again. How can have the macro automatically confirm deletion of the sheet.
 
Tim

Sub test()
Application.DisplayAlerts = False
Sheets("Sheet1").Delete
Application.DisplayAlerts = True
End Sub


--
XL2002
Regards

William

(e-mail address removed)

| In a macro that I am using, I need to delete a sheet. When I record the
macro and then replay it, it brings up the confirmation dialog again. How
can have the macro automatically confirm deletion of the sheet.
 
Tim

Application.DisplayAlerts = False
' your code
Application.DisplayAlerts = True


Regards

Trevor


Tim said:
In a macro that I am using, I need to delete a sheet. When I record the
macro and then replay it, it brings up the confirmation dialog again. How
can have the macro automatically confirm deletion of the sheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top