Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to delete Excel worksheet using VBA without delete dialog?

In my VBA macro, I delete a worksheet. A dialog displays asking if I really
want to delete the worksheet. The answer is always yes therefore I do not
want the user to have to click the Delete button so the macro can continue.
Is there any way to turn off this "feature"?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to delete Excel worksheet using VBA without delete dialog?

Hi cocalico22

You can use DisplayAlerts

Sub DeleteActiveSheet()
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"cocalico22" wrote in message ...
In my VBA macro, I delete a worksheet. A dialog displays asking if I really
want to delete the worksheet. The answer is always yes therefore I do not
want the user to have to click the Delete button so the macro can continue.
Is there any way to turn off this "feature"?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to delete Excel worksheet using VBA without delete dialog?

application.displayalerts = false
'delete the sheet code here
application.displayalerts = true

cocalico22 wrote:

In my VBA macro, I delete a worksheet. A dialog displays asking if I really
want to delete the worksheet. The answer is always yes therefore I do not
want the user to have to click the Delete button so the macro can continue.
Is there any way to turn off this "feature"?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default How to delete Excel worksheet using VBA without delete dialog?

Application.DisplayAlerts = False
Worksheets("Sheet1").Delete
Application.DisplayAlerts = True

--
Charles Chickering

"A good example is twice the value of good advice."


"cocalico22" wrote:

In my VBA macro, I delete a worksheet. A dialog displays asking if I really
want to delete the worksheet. The answer is always yes therefore I do not
want the user to have to click the Delete button so the macro can continue.
Is there any way to turn off this "feature"?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How to delete Excel worksheet using VBA without delete dialog?

put this line in front of your group of code that deletes the worksheet

Application.DisplayAlerts = False

then put this after

Application.DisplayAlerts = True

I think that should take care of it.



"cocalico22" wrote:

In my VBA macro, I delete a worksheet. A dialog displays asking if I really
want to delete the worksheet. The answer is always yes therefore I do not
want the user to have to click the Delete button so the macro can continue.
Is there any way to turn off this "feature"?

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
Delete worksheet - dialog box showing Rick A[_2_] Excel Programming 1 May 24th 06 04:21 PM
changing options in delete dialog box marthann Excel Discussion (Misc queries) 1 March 23rd 06 09:16 PM
Delete a Sheet without dialog Ken Loomis Excel Programming 4 March 24th 05 11:25 PM
Disable Worksheet Delete Dialog Greg Excel Programming 1 March 1st 05 08:32 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 10:04 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"