ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting A Worksheet - There may be data ... (https://www.excelbanter.com/excel-programming/334674-deleting-worksheet-there-may-data.html)

Chaz

Deleting A Worksheet - There may be data ...
 
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

STEVE BELL

Deleting A Worksheet - There may be data ...
 
Enclose your code in:

Application.DisplayAlerts = False

' your code

Application.DisplayAlerts = True

--
steveB

Remove "AYN" from email to respond
"Chaz" wrote in message
...
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




Nigel

Deleting A Worksheet - There may be data ...
 
Use the following......

Application.DisplayAlerts = False

Sheets("Name").Delete

Application.DisplayAlerts = True

--
Cheers
Nigel



"Chaz" wrote in message
...
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




Tim Williams

Deleting A Worksheet - There may be data ...
 
application.displayalerts=false
'do stuff
application.displayalerts=true

Tim


--
Tim Williams
Palo Alto, CA


"Chaz" wrote in message
...
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





All times are GMT +1. The time now is 05:29 PM.

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