Confirm Delete in a macro

T

Tim

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.
 
W

William

Tim

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


--
XL2002
Regards

William

[email protected]

| 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.
 
T

Trevor Shuttleworth

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.
 
Top