Deleting A Worksheet - There may be data ...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the course of a macro, i create a worksheet edit some data and then
transfer the data to another sheet. When i delete the worksheet using the
command

Sheets("Name").Delete

I am prompted that there may be data in the worksheet and asks for
confirmation that i want that sheet deleted. This occurs even if i delete
all the occupied cells in a sheet. How can i turn this prompt off?

Thanks
 
Enclose your code in:

Application.DisplayAlerts = False

' your code

Application.DisplayAlerts = True
 
Use the following......

Application.DisplayAlerts = False

Sheets("Name").Delete

Application.DisplayAlerts = True
 
application.displayalerts=false
'do stuff
application.displayalerts=true

Tim
 

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