Solved

Excel VBA Clear Subtotal Buttons

Posted on 2014-04-08
9
679 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
  • 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
 

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now