Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default another macro query - deleting a worksheet within a query

I've got the following code in a macro to delete a worksheet within a
spreadsheet i've devised.

Sheets("Lookup tables").Select
ActiveWindow.SelectedSheets.Delete

When run, the macro (which is part of a larger macro) requests the user to
confirm the deletion of the worksheet.

Is there a piece of code I can enter to avoid this msg box appearing. I
would like the macro to automatically delete the worksheet and not ask for
confirmation to do so.

Many thanks,

David Hawes
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default another macro query - deleting a worksheet within a query

This should do the trick

Sub deleteit()
Application.DisplayAlerts = False

Sheets("sheet1").Select

ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
End Sub

"DavidHawes" wrote:

I've got the following code in a macro to delete a worksheet within a
spreadsheet i've devised.

Sheets("Lookup tables").Select
ActiveWindow.SelectedSheets.Delete

When run, the macro (which is part of a larger macro) requests the user to
confirm the deletion of the worksheet.

Is there a piece of code I can enter to avoid this msg box appearing. I
would like the macro to automatically delete the worksheet and not ask for
confirmation to do so.

Many thanks,

David Hawes

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default another macro query - deleting a worksheet within a query

Many thanks - a handy piece of code to know as well.

Thanks again.

"Mike" wrote:

This should do the trick

Sub deleteit()
Application.DisplayAlerts = False

Sheets("sheet1").Select

ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
End Sub

"DavidHawes" wrote:

I've got the following code in a macro to delete a worksheet within a
spreadsheet i've devised.

Sheets("Lookup tables").Select
ActiveWindow.SelectedSheets.Delete

When run, the macro (which is part of a larger macro) requests the user to
confirm the deletion of the worksheet.

Is there a piece of code I can enter to avoid this msg box appearing. I
would like the macro to automatically delete the worksheet and not ask for
confirmation to do so.

Many thanks,

David Hawes

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
Importing Data via Web Query - Can values be passed to query? [email protected] Excel Discussion (Misc queries) 5 May 9th 06 06:21 PM
Save data retreived from query without saving query Anthony Excel Discussion (Misc queries) 0 January 25th 06 07:17 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 1 November 29th 05 01:44 PM
Microsoft Query rejects "nz" function in Access Query Vaughan Excel Discussion (Misc queries) 0 May 4th 05 05:20 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 09:57 AM.

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"