Macro to AutoAnswer

T

tc

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?
 
P

papou

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
 
J

JW

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top