Hiding, or automatically answering, a confirmation msgbox

  • Thread starter Thread starter Brian Beck
  • Start date Start date
B

Brian Beck

In a macro I have, I create a new worksheet to do some work in and then
later in the macro, I delete the worksheet since it is no longer needed.
(There is another worksheet in this workbook that is always there when this
macro runs) When the macro sends the command to delete the worksheet, a
msgbox pops up telling me that there may be data in the worksheet I'm
deleting and am I sure that I want to delete it. I click on the "Delete"
button and the macro continues on its merry way.

How can I either get rid of the msgbox appearing, or put something in the
macro that will automatically select "Delete" on the msgbox so that there is
no interaction from the user required for the macro to finish running?

-Brian
 
In your code to delet the sheet you need to insert:-

Application.DisplayAlerts = false

following this you then need the code to delete the sheet and then you
need to have:-

Application.DisplayAlerts = True

To turn the alerts back on again, otherwise you wont be alerted about
anything else which may happen in your sheet.

Hope this helps,
Mat
For Excel Tutorials and Tips: http://teachr.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top