ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Spreadsheet without Error (https://www.excelbanter.com/excel-programming/306279-delete-spreadsheet-without-error.html)

Mike D.[_2_]

Delete Spreadsheet without Error
 
Hi.

I currently am deleting sheets in a macro with the command:

ActiveWindow.SelectedSheets.Delete

Each time it is executed, it prompts me with a message
that says "Data may exist ..."

How do I tell my macro to skip this?

Thanks,
Mike.


Tom Ogilvy

Delete Spreadsheet without Error
 
Possibly

application.DisplayAlerts = False
ActiveWindow.Selectedsheets.Delete
Application.DisplayAlerts = True

--
Regards,
Tom Ogilvy

"Mike D." wrote in message
...
Hi.

I currently am deleting sheets in a macro with the command:

ActiveWindow.SelectedSheets.Delete

Each time it is executed, it prompts me with a message
that says "Data may exist ..."

How do I tell my macro to skip this?

Thanks,
Mike.




Trevor Shuttleworth

Delete Spreadsheet without Error
 
Mike

you could try:

Application.DisplayAlerts = False
' your code
Application.DisplayAlerts = True

Regards

Trevor


"Mike D." wrote in message
...
Hi.

I currently am deleting sheets in a macro with the command:

ActiveWindow.SelectedSheets.Delete

Each time it is executed, it prompts me with a message
that says "Data may exist ..."

How do I tell my macro to skip this?

Thanks,
Mike.




Frank Kabel

Delete Spreadsheet without Error
 
Hi
try
application.displayalerts=false
ActiveWindow.SelectedSheets.Delete
application.displayalerts=true

--
Regards
Frank Kabel
Frankfurt, Germany


Mike D. wrote:
Hi.

I currently am deleting sheets in a macro with the command:

ActiveWindow.SelectedSheets.Delete

Each time it is executed, it prompts me with a message
that says "Data may exist ..."

How do I tell my macro to skip this?

Thanks,
Mike.


Mike D.[_2_]

Delete Spreadsheet without Error
 
Thanks, Tom, Trevor, and Frank! This worked.


-----Original Message-----
Hi.

I currently am deleting sheets in a macro with the

command:

ActiveWindow.SelectedSheets.Delete

Each time it is executed, it prompts me with a message
that says "Data may exist ..."

How do I tell my macro to skip this?

Thanks,
Mike.

.



All times are GMT +1. The time now is 03:28 PM.

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