Stopping the "This removes the subtotal and sorts again." notifica

G

Guest

I am running a macro across multiple tabs where I am removing subtotals.
Prior to the removal of the subtotals for each tab the "This removes the
subtotal and sorts again" notification pops-up and the "OK" button must be
clicked to proceed. How can I turn off this notification?
 
G

Guest

Untested but you could try this...

Application.displayalerts = false
'Your code here
Application.displayalerts = true
 
G

Guest

From the help on displayalerts:

"If you set this property to False, Micorosoft Excel sets this property to
True when the code is finished, unless you are running cross process code."

so while there is nothing wrong with what you suggest, what you imply is
usually not the case.

--
Regards,
Tom Ogilvy
 
G

Guest

Absolutely true and thanks for clearing that up. That and being a little bit
lazy is why I left the error handler out in my original code. Display alerts
is one of those automatic resetting switches. Unlike some other switches that
do not reset themselves, such as EnableEvents. IMO you are best off to always
use an error handler. As you point out it is not always necesary, but it
never hurts. An error handler only takes a few seconds to add and if you are
wrong about what gets automatically reset, or Excel decides to change the way
it handles these things (like that would ever happen <bg>)then you are
covered. Just my two cents...
 

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