Solved

Excel VBA Clear Subtotal Buttons

Posted on 2014-04-08
9
705 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

816 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

8 Experts available now in Live!

Get 1:1 Help Now