Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting Custom Views when Deleting Sheets ExcelMonkey Excel Programming 1 March 28th 07 06:11 AM
Deleting Sheets oakman[_34_] Excel Programming 4 August 15th 06 03:43 PM
Deleting Sheets ExcelMonkey[_190_] Excel Programming 1 March 25th 05 10:02 AM
Deleting Sheets Jordan[_3_] Excel Programming 4 February 13th 04 03:19 PM
deleting sheets david Excel Programming 2 July 31st 03 01:02 AM


All times are GMT +1. The time now is 08:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"