Delete Sheet In VBA Without Notification
Question: While deleting a Sheet from the Workbook using VBA/Macro, i get one Excel inbuilt Notification to confirm the deletion. I want to show only my own built notification to confirm the deletion. How to disable that notification in VBA.
Solution: It is very easy to disable this notification while deleting a sheet from Excel. Just we need to set .DisplayAlerts as False
Private Sub CommandButton1_Click() '--- disable all types of Alerts from Excel like while deleting the Sheet etc. Application.DisplayAlerts =False '--- Now delete the particular Sheet Worksheets("Sheet2").delete '--- Again enable the alerts Application.DisplayAlerts = True End Sub
Note: After deleting make sure that we are again setting the .DisplayAlerts as True. Otherwise, even if we are deleting any sheet from any of the Excel Sheet in your PC, no Alert will appear. So always disable it before deleting and then again enable it back after deletion.
My name is Vishwamitra Mishra. Friends Call me Vishwa. This blog is authored by me. I am an Excel Geek. Well, this blog talks a lot about my passion in Excels & Macros so I’ll not talk about it :) I am very much passionate about traveling & quite recently discovered that I am a good photographer too..:P
AND GET A FREE!
E-BOOK FOR EXCEL VBA BEGINNERS
DON'T MISS ANY NEW ARTICLE !
Get your FREE! E-Book & Have Every New Article Delivered Straight To Your Email-Box