Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting sheets
I have a procedure that deletes sheets from the workbook. The problem I have
is Excel has window pop up that asks if I still want to delete the sheet. If I select cancel the procedure continues to run as if the sheet was deleted. How do I stop the procedure if delete sheet is canceled or get the window not to pop up? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting sheets
Application.DisplayAlerts = False
Sheets("Sheet 1").Delete Application.DisplayAlerts = True The above code should keep the message from appearing. If you let the message pop up then you need to check if the sheet still exists after the delete... -- HTH... Jim Thomlinson "ranswrt" wrote: I have a procedure that deletes sheets from the workbook. The problem I have is Excel has window pop up that asks if I still want to delete the sheet. If I select cancel the procedure continues to run as if the sheet was deleted. How do I stop the procedure if delete sheet is canceled or get the window not to pop up? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting sheets
Thanks
"Jim Thomlinson" wrote: Application.DisplayAlerts = False Sheets("Sheet 1").Delete Application.DisplayAlerts = True The above code should keep the message from appearing. If you let the message pop up then you need to check if the sheet still exists after the delete... -- HTH... Jim Thomlinson "ranswrt" wrote: I have a procedure that deletes sheets from the workbook. The problem I have is Excel has window pop up that asks if I still want to delete the sheet. If I select cancel the procedure continues to run as if the sheet was deleted. How do I stop the procedure if delete sheet is canceled or get the window not to pop up? Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting sheets
You have to change the macro to something like...
'/--------------------------------------------------------/ varAnswer = MsgBox("Delete worksheet?", vbYesNo) If varAnswer < vbYes Then Exit Sub End If '/--------------------------------------------------------/ -- Hope this helps. If this post was helpfull, please remember to click on the ''''YES'''' button at the bottom of the screen. Thanks, Gary Brown "ranswrt" wrote: I have a procedure that deletes sheets from the workbook. The problem I have is Excel has window pop up that asks if I still want to delete the sheet. If I select cancel the procedure continues to run as if the sheet was deleted. How do I stop the procedure if delete sheet is canceled or get the window not to pop up? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting Custom Views when Deleting Sheets | Excel Programming | |||
Deleting Sheets | Excel Programming | |||
Deleting Sheets | Excel Programming | |||
Deleting Sheets | Excel Programming | |||
deleting sheets | Excel Programming |