Deleting sheets

B

Brian Matlack

Hi!
Before ending my macro I delete these two sheets but Excel gives me a
warning prompt before deleting the sheets that I must OK. Is there a
way to avoid the prompt and delete the sheets without interrupting the
code?

<start code>
Sheets("sheet1").Select
ActiveWindow.SelectedSheets.Delete
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Delete
<end code>

Thanks!!
 
C

Chip Pearson

You can use the Application.DisplayAlerts property to suppress
the message. E.g.,


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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Brian Matlack"
<[email protected]>
wrote in message
news:[email protected]...
 
B

Brian Matlack

Chip said:
You can use the Application.DisplayAlerts property to suppress
the message. E.g.,


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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Brian Matlack"
<[email protected]>
wrote in message
Thanks Chip!!
 

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

Top