ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subtotals in object model? (https://www.excelbanter.com/excel-programming/280201-subtotals-object-model.html)

Josh Sale

Subtotals in object model?
 
I have a worksheet with a data list that uses Subtotals which I
programmatically create but that users sometimes modify (e.g., they change
the page break before and after).

Under certain circumstances I need to remove the Subtotals, do some
processing and then put back the Subtotals.

I've searched around in the Excel object model looking for the
representation of an active Subtotal but not found anything. Is the
definition of an existing Subtotal available to VBA? If so, I'll save away
all of the current settings, remove the existing subtotals, do my processing
and then reinstate the Subtotals as they were before I removed them.

TIA,

josh


steve

Subtotals in object model?
 
Josh,

If you're using SubTotals from the Data menu you can record making and
deleting them. Then edit your code to get what you want...

--
sb
"Josh Sale" <jsale@tril dot cod wrote in message
...
I have a worksheet with a data list that uses Subtotals which I
programmatically create but that users sometimes modify (e.g., they change
the page break before and after).

Under certain circumstances I need to remove the Subtotals, do some
processing and then put back the Subtotals.

I've searched around in the Excel object model looking for the
representation of an active Subtotal but not found anything. Is the
definition of an existing Subtotal available to VBA? If so, I'll save

away
all of the current settings, remove the existing subtotals, do my

processing
and then reinstate the Subtotals as they were before I removed them.

TIA,

josh




Josh Sale

Subtotals in object model?
 
I am using the Subtotals from the Data menu.

However, recording making and deleting them doesn't tell me what I need.

In particular, I need to figure out after the fact (i.e., after the user has
modified a programmatically created Subtotal) what they did so that I can
later restore the Subtotal. For example, I create a Subtotal without page
breaks between groups and summary data below. The user changes the Subtotal
to include page breaks and have summary data above.

I need to discover the current state of the Subtotals so that I can remove
them, do some processing and then recreate them as the user last had them.



All times are GMT +1. The time now is 08:05 AM.

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