How can I disable system alerts (deleting a sheet for example)
Mr. Deitrick,
thank you very much for your answer.
Could you, please, also tell me if there is anything like "deleteworksheet"
event in excel, so that I could tie the macro to this event and delete the
sheets normally, but without the alert?
Thank you.
Andrii.
"Bernie Deitrick" wrote:
Use a macro. Copy the macro below into your personal.xls file, and then assign it to a custom
commandbar button.
HTH,
Bernie
MS Excel MVP
Sub KillSheet()
Application.DisplayAlerts = False
On Error GoTo NoWorkbooks
If ActiveSheet.Type = 3 Then
ActiveChart.Delete
Else
If ActiveWindow.SelectedSheets.Count < _
ActiveWorkbook.Worksheets.Count Then
ActiveWindow.SelectedSheets.Delete
Else
If MsgBox("That's the last sheet." & Chr(10) & _
"Do you want to close the file without saving?", _
vbYesNo) = vbYes Then
ActiveWorkbook.Close False
End If
End If
End If
NoWorkbooks:
Application.DisplayAlerts = True
End Sub
"andriil" wrote in message
...
Every time delete a sheet, I get a system alert saying "Data may exist in the
sheet(s) selected for deletion. To permanently delete the data, press
Delete". It's a bit annoying when you have to delete many sheets and you
don't want to select multiple sheets. Is there any possibility to disable
this alert?
|