Delete a sheet

N

Newbie

Hi
I want to be able to delete a sheet - how can I stop the system confirmation
message appearing.

In access I use docmd.setwarnings = false - is there something similar for
Excel

Thanks
 
C

Chip Pearson

Try something like

Application.DisplayAlerts = False
' delete the sheet
Application.DisplayAlerts = True


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

Newbie

thanks - works a treat!

Chip Pearson said:
Try something like

Application.DisplayAlerts = False
' delete the sheet
Application.DisplayAlerts = True


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

David McRitchie

Don't know if it would be of interest since you are already
working with a macro of your own.

I have a macro that I invoke from the toolbar to delete
the active sheet under certain conditions.

If there is code associated with the sheet -- don't delete
and exit the macro.

If the sheetname begins with "Sheet" then delete without warning.
Otherwise, let the standard dialog come up with warning.

Keeps me out of trouble when I go through all the worksheets
quickly. I use toolbar buttons to do that but you can go through
the worksheets with Ctrl+PageUp or Ctrl+PageDown.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

Chip Pearson said:
Application.DisplayAlerts = False
' delete the sheet
Application.DisplayAlerts = True

Newbie said:
I want to be able to delete a sheet - how can I stop the system
confirmation message [from] appearing.
 
Top