Solved

Excel VBA Clear Subtotal Buttons

Posted on 2014-04-08
9
776 Views
Last Modified: 2014-04-13
I have a Excel Workbook with multiple sheets that have subtotals. I would like to remove the subtotal buttons with VBA on all sheets.
0
Comment
Question by:shieldsco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 19

Expert Comment

by:regmigrant
ID: 39986299
Do you mean the subtotal fomula (eg: =subtotal(9,A1:a5) or that there is a Row/Column labelled 'subtotal' or that there is an actual button marked 'subtotal' and you want to delete it ?
0
 

Author Comment

by:shieldsco
ID: 39986309
No the subtotal buttons on the left. Manually I can go to Data. Ungroup and clea outline
0
 
LVL 19

Expert Comment

by:regmigrant
ID: 39986331
assuming the data starts in A1 - try:


    Range("A1").Select
    Selection.RemoveSubtotal
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:shieldsco
ID: 39986370
I do not want to remove sutotals --I want to clear the outline.. clearoutline on all sheets in the workbook
0
 

Accepted Solution

by:
shieldsco earned 0 total points
ID: 39986408
I figured it out -- here is the code:
'Clear Subtotal Buttons
  Application.ScreenUpdating = False
    Dim wkSt As String
    Dim wkBk As Worksheet
    wkSt = ActiveSheet.Name
    For Each wkBk In ActiveWorkbook.Worksheets
        On Error Resume Next
        wkBk.Activate
        Selection.ClearOutline
               
               
    Next wkBk
    Sheets(wkSt).Select
    Application.ScreenUpdating = True
0
 

Author Comment

by:shieldsco
ID: 39986442
'Clear Subtotal Buttons
  Application.ScreenUpdating = False
    Dim wkSt As String
    Dim wkBk As Worksheet
    wkSt = ActiveSheet.Name
    For Each wkBk In ActiveWorkbook.Worksheets
        On Error Resume Next
        wkBk.Activate
        Selection.ClearOutline
               
               
    Next wkBk
    Sheets(wkSt).Select
    Application.ScreenUpdating = True
0
 
LVL 19

Expert Comment

by:regmigrant
ID: 39986639
that's not the question that was asked - but whatever
0
 

Author Closing Comment

by:shieldsco
ID: 39997144
I was able to figure out the solution without help from an expert.
0
 
LVL 19

Expert Comment

by:regmigrant
ID: 39997497
its gone beyond the points but if you are asking questions please try to be explicit about what you are trying to achieve:-

your question:
"I would like to remove the subtotal buttons with VBA on all sheets. "

the answer you came up with:-
"Selection.ClearOutline"

Apart from not explaining what you meant by 'Subtotal buttons' you seem to be unaware that Outlines and Subtotals are different things - so it was a waste of time for all concerned.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question