Automatically Confirm Deleting Charts

F

fatfish

Hi All,

I'd like to clean all the created charts after analysis,
so I record a macro to delete the charts one by one.

The problem is: there will always popup a msg box asking
me to confirm deleting the charts.

Is there a way to disable the confirming deleting msg?

Thanks in advance
 
F

Frank Kabel

Hi
try

application.displayalerts=false
'your deletion code
application.displayalerts=true
 
A

Amedee Van Gasse

fatfish said:
Hi All,

I'd like to clean all the created charts after analysis,
so I record a macro to delete the charts one by one.

The problem is: there will always popup a msg box asking
me to confirm deleting the charts.

Is there a way to disable the confirming deleting msg?

Thanks in advance!


Put this at the start of *every* macro you record:

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

And this at the end:

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

It's the DisplayAlerts stuff that will solve your problem.


PS: Please don't thank people in advance. It's more polite (and more
motivating) to thank them afterwards.
 
F

fatfish

Hi Frank & Amedee,

Thanks!
Both of them works very well!!

Amedee's code also disable the screenupdating, which makes
the macro "cleaner"! ;)
and thanks for your suggestion of "No thanks in advance" ! :p

Best Regards,
Fatfis
 
A

Amedee Van Gasse

fatfish said:
Hi Frank & Amedee,

Thanks!
Both of them works very well!!

Amedee's code also disable the screenupdating, which makes
the macro "cleaner"! ;)
and thanks for your suggestion of "No thanks in advance" ! :p

Best Regards,
Fatfish

Thank you for thanking me. Now nothing can spoil my day! :)
 
Top