ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help! Excel Macro Delete function!! (https://www.excelbanter.com/excel-programming/305788-help-excel-macro-delete-function.html)

wmcray[_3_]

Help! Excel Macro Delete function!!
 
I use the following command in the Excel Macro to delete an Exce
worksheet called "Report":

Sheets("Report").Delete

However when I run the macro, the user will be prompted if th
worksheet "Report" should be deleted.

I do not want user to be asked. Instead I want the worksheet "Report
to be deleted automatically.

Can anyone please advise if there is a command to "force" delete th
worksheet without asking the confirmation from user?

Million Thank

--
Message posted from http://www.ExcelForum.com


merjet

Help! Excel Macro Delete function!!
 
I do not want user to be asked. Instead I want the worksheet "Report"
to be deleted automatically.

Can anyone please advise if there is a command to "force" delete the
worksheet without asking the confirmation from user?


Application.DisplayAlerts = False
Worksheets("Report").Delete
Application.DisplayAlerts = True
HTH,
Merjet





wmcray[_4_]

Help! Excel Macro Delete function!!
 
Thank you!! It works nicely

--
Message posted from http://www.ExcelForum.com


Amedee Van Gasse[_3_]

Help! Excel Macro Delete function!!
 
wmcray wrote:

I use the following command in the Excel Macro to delete an Excel
worksheet called "Report":

Sheets("Report").Delete

However when I run the macro, the user will be prompted if the
worksheet "Report" should be deleted.

I do not want user to be asked. Instead I want the worksheet "Report"
to be deleted automatically.

Can anyone please advise if there is a command to "force" delete the
worksheet without asking the confirmation from user?

Million Thanks


---
Message posted from http://www.ExcelForum.com/


Start every macro with

With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
.DisplayAlerts = False
End With

and end with

With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
.DisplayAlerts = True
End With

--
Amedee Van Gasse using XanaNews 1.16.3.1
If it has an "X" in the name, it must be Linux?
Please don't thank me in advance. Thank me afterwards if it works or
hit me in the face if it doesn't. ;-)

PS: I found 2 small shortcomings on www.excelforum.com:
1. You do *not* have to pay for access to news:msnews.microsoft.com
2. A *real* newsreader (not Outlook Express) is actually very easy to
use. See www.newsreaders.com for more info.


All times are GMT +1. The time now is 04:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com