Bypass Delete Confirmation


November 29, 2001 - by Bill Jelen

Bill sends today's question:

How can I stop the confirmation box from needing to be clicked "OK" when deleting files or sheets called to be deleted within a MACRO under Excel 97.

Use the DisplayAlerts property:

Application.DisplayAlerts = False
Worksheets("MySheet").Delete
Application.DisplayAlerts = True


Bill Jelen is the author / co-author of:
MrExcel 2021 – Unmasking Excel

This is a 5th edition of MrExcel XL. Updates for 2021 include: LAMBDA, LET, Power Query Fuzzy Match, Sort & Filter in Sheet View, Cut-out people, Save object as image, STOCKHISTORY, Wolfram Alpha Data Types, Custom Data Types from Power Query, Weather data types, bilingual spreadsheets, Performance improvements, Unhide multiple worksheets, Action pen, Collapsible task panes, LET function to re-use calculations, store formulas using LAMBDA, Recursive LAMBDA, Branching LAMBDA, Lambda to return a picture, Excel function quick reference.