Results 1 to 7 of 7

[SOLVED] Delete Subtotal if It Exists

Threaded View

  1. #1
    Registered User
    Join Date
    06-08-2016
    Location
    Seymour, Connecticut
    MS-Off Ver
    2013 MS Office
    Posts
    29

    [SOLVED] Delete Subtotal if It Exists

    Hi Guys-

    Hoping someone may be able to shed some light on this.

    I have a macro I've created but I want the macro to start by deleting the information and getting rid of the subtotals that we're there previously.

    The current code I have is this:

        With Sheets("ActivantSKUAdjustments").Columns("A:J")
        
            .Delete Shift:=xlToLeft
            .RemoveSubtotal
        
        End With
    The problem is that if for some reason that subtotal isn't there, I get the error message:

    Run time error 424 Object Required. I want the macro to delete the subtotals if they are there but not do anything if they aren't. Any advice?
    Last edited by skellz022782; 07-11-2016 at 08:38 AM. Reason: Solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SUBTOTAL: Delete all rows associated with subtotal less than certain value
    By bikerchick1111 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2016, 12:20 PM
  2. Test if subtotal exists
    By jmicdk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-03-2016, 12:51 PM
  3. [SOLVED] Delete sheet if it exists
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-15-2015, 03:08 PM
  4. Im New...if subtotal exists then remove. if subtotal doesnt exist do nothing
    By ci89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2015, 04:53 PM
  5. Subtotal - Delete zero Subtotal and prior rows that calculate to that zero Subtotal
    By Whatsherface in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2012, 08:37 PM
  6. if a worksheet exists delete it
    By pavlos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2010, 03:15 AM
  7. Delete worksheet IF it exists
    By treva26 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2007, 10:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1