ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to AutoAnswer (https://www.excelbanter.com/excel-programming/397243-macro-autoanswer.html)

tc

Macro to AutoAnswer
 
Hi. The macro i have made deletes a particular sheet after
calculations have been made. however Excel gives me a warning that the
sheet might contain data, are you sure you want to delete it. Is it
possible to create a macro to automatically answer this question?


papou[_2_]

Macro to AutoAnswer
 
Hello
Include this into your macro before the sheet deletion:
Application.DisplayAlerts = False
'... your code here

'And remember to set it back to :
Application.DisplayAlerts = True
'when you're finished

HTH
Cordially
Pascal


"tc" a écrit dans le message de news:
...
Hi. The macro i have made deletes a particular sheet after
calculations have been made. however Excel gives me a warning that the
sheet might contain data, are you sure you want to delete it. Is it
possible to create a macro to automatically answer this question?




JW[_2_]

Macro to AutoAnswer
 
You can simply make the warning not display at all. Just have to be
certain that you cut the displays back on.
Sub foo()
Application.DisplayAlerts = False
Sheets(1).Delete
Application.DisplayAlerts = True
End Sub


tc wrote:
Hi. The macro i have made deletes a particular sheet after
calculations have been made. however Excel gives me a warning that the
sheet might contain data, are you sure you want to delete it. Is it
possible to create a macro to automatically answer this question?




All times are GMT +1. The time now is 11:13 AM.

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