ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro : confirm Delete (https://www.excelbanter.com/excel-programming/294245-macro-confirm-delete.html)

TOM

Macro : confirm Delete
 
Dear,

I am useing this macro :

Sheets("XXX").Select
ActiveWindow.SelectedSheets.Delete

Then a messagebox appears to confirm to delete the data.
How can I klick "Delete" automatically (or avoid this
msgbox)?

Thanks !
Tom

Bob Phillips[_6_]

Macro : confirm Delete
 
Hi Tom,

Application.DisplayAlerts = False
Sheets("XXX").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplaAlerts = True

as you are only deleting the one sheet it can also be simplified to

Application.DisplayAlerts = False
ActiveWorkbook.Sheets("XXX").Delete
Application.DisplaAlerts = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tom" wrote in message
...
Dear,

I am useing this macro :

Sheets("XXX").Select
ActiveWindow.SelectedSheets.Delete

Then a messagebox appears to confirm to delete the data.
How can I klick "Delete" automatically (or avoid this
msgbox)?

Thanks !
Tom




No Name

Macro : confirm Delete
 
Thank you !!


-----Original Message-----
Hi Tom,

Application.DisplayAlerts = False
Sheets("XXX").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplaAlerts = True

as you are only deleting the one sheet it can also be

simplified to

Application.DisplayAlerts = False
ActiveWorkbook.Sheets("XXX").Delete
Application.DisplaAlerts = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tom" wrote in

message
...
Dear,

I am useing this macro :

Sheets("XXX").Select
ActiveWindow.SelectedSheets.Delete

Then a messagebox appears to confirm to delete the

data.
How can I klick "Delete" automatically (or avoid this
msgbox)?

Thanks !
Tom



.



All times are GMT +1. The time now is 10:32 AM.

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