ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting a sheet during macro (https://www.excelbanter.com/excel-programming/433585-deleting-sheet-during-macro.html)

jeff

Deleting a sheet during macro
 
During a macro, a sheet is deleted. However, the user gets a box that
basically asks if it’s ok to continue. The message is “Data may exist
in the sheet(s) selected for deletion. To permanently delete the data,
press Delete.”
Is there a way to prevent this message from coming up? It will only
cause confusion to the user.
Thanks,
jeff

Rick Rothstein

Deleting a sheet during macro
 
Try it this way...

Application.DisplayAlerts = False
Sheets("Sheet8").Delete 'Change sheet name as needed
Application.DisplayAlerts = True

--
Rick (MVP - Excel)


"jeff" wrote in message
...
During a macro, a sheet is deleted. However, the user gets a box that
basically asks if it’s ok to continue. The message is “Data may exist
in the sheet(s) selected for deletion. To permanently delete the data,
press Delete.”
Is there a way to prevent this message from coming up? It will only
cause confusion to the user.
Thanks,
jeff



All times are GMT +1. The time now is 01:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com