Macro : confirm Delete

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

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
 
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)
 
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)




.
 

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