Removing confirmation POP from excel

S

singh

Hi All

In one of my macro i have provided code for deleting a particular sheet.
In between a pop up appears asking for confirmation for delete or cancel the
sheet.
Is there any way we can remove this prompt?

I tried Application.DisplayAlerts = False. this thing is not proper for this.

Thanks in Advance/
 
N

Norman Jones

Hi Singh,

The following works for me

'==========>>
Public Sub aTester()
With Application
.DisplayAlerts = False
ActiveSheet.Delete
.DisplayAlerts = False
End With
End Sub
'<<==========


Why do you say:
I tried Application.DisplayAlerts = False. this thing is not proper for
this.
 
J

Joel

You want FALSE, not TRU

singh said:
Hi
Thanks for the reply
Am using
Activeworksheet.Delete
Application.DisplayAlerts = True
I do not need writing the sheet name in the macro.
Still am getting the POP up.
 
N

Norman Jones

Hi Singh,
It is working for me too......... Perfect.

Actually, there is a potentially significant typo!

The second instance of

should reinstate alerts.

Therefore, replace the code with:

'==========>>
Public Sub aTester()
With Application
.DisplayAlerts = False
ActiveSheet.Delete
.DisplayAlerts = True '<<=======
End With
End Sub
'<<==========

Normally, Excel will automatically reset
the property to true when the code finishes,
but there could be repercussions with cross
processing code.

Apologies for the typo!
 

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