ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check for & remove Subtotal(s) (https://www.excelbanter.com/excel-programming/368249-check-remove-subtotal-s.html)

josnah[_6_]

Check for & remove Subtotal(s)
 

Currently I'm using a msgbox to ask users to manually remove subtotals
before proceeding.

If MsgBox("Pls ensure that subtotals, if any, are removed before
proceeding", vbOKCancel) = vbCancel Then Exit Sub

How can I include in my macro to first check if there is a subtotal(s)
& to remove all?
Or maybe stop the macro if there are subtotals found in the worksheet?
:confused:

Any help is greatly appreciated!


--
josnah
------------------------------------------------------------------------
josnah's Profile: http://www.excelforum.com/member.php...fo&userid=6334
View this thread: http://www.excelforum.com/showthread...hreadid=564663


Tom Ogilvy

Check for & remove Subtotal(s)
 
It wouldn't be definitive, but you could use
ActiveWindow.DisplayOutline

to see if the outline symbols are displayed.

If the data normally would not have formulas in it you could also check for
a subtotal formula using Find or use specialcells to find cells with
formulas.

--
Regards,
Tom Ogilvy


"josnah" wrote:


Currently I'm using a msgbox to ask users to manually remove subtotals
before proceeding.

If MsgBox("Pls ensure that subtotals, if any, are removed before
proceeding", vbOKCancel) = vbCancel Then Exit Sub

How can I include in my macro to first check if there is a subtotal(s)
& to remove all?
Or maybe stop the macro if there are subtotals found in the worksheet?
:confused:

Any help is greatly appreciated!


--
josnah
------------------------------------------------------------------------
josnah's Profile: http://www.excelforum.com/member.php...fo&userid=6334
View this thread: http://www.excelforum.com/showthread...hreadid=564663




All times are GMT +1. The time now is 10:06 PM.

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