VBA Subtotal question

H

hooper

The SUBTOTAL function in Excel will subtotal a list and show an outline
control on the left of the screen. The outline control allows the user to
change the amount of data shown in the sheet (data with subtotals, only
subtotals or only grand total). Can this outline control be programmed via
VBA? I would like to have a list that only shows the subtotals (without the
source data displayed)? Will I have to switch to a Pivot Table to
accomplish this task?

Thanks
 
D

Dave Peterson

Record a macro when you show/hide the data you want.

You'll see code like:

ActiveSheet.Outline.ShowLevels RowLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=3
 

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