Results 1 to 8 of 8

Sorting by Alpha, Adding Subtotal - then removing subtotal - variable data sets

Threaded View

gregg_grug Sorting by Alpha, Adding... 10-25-2018, 06:54 PM
Kaper Re: Sorting by Alpha, Adding... 10-27-2018, 09:40 AM
gregg_grug Re: Sorting by Alpha, Adding... 10-31-2018, 10:28 PM
Kaper Re: Sorting by Alpha, Adding... 11-02-2018, 03:58 AM
gregg_grug Re: Sorting by Alpha, Adding... 11-26-2018, 12:17 AM
Kaper Re: Sorting by Alpha, Adding... 11-26-2018, 03:47 AM
gregg_grug Re: Sorting by Alpha, Adding... 12-04-2018, 07:22 PM
gregg_grug Re: Sorting by Alpha, Adding... 01-03-2019, 07:41 PM
  1. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,896

    Re: Sorting by Alpha, Adding Subtotal - then removing subtotal - variable data sets

    Hi,

    I assume that using http://www.excelforum.pl/download.htm?id=69841 I could find what changes / how "range is variable"

    So the first suggestion is that data is added or removed at the bottom of the range, column A has some kind of index/unique ID so is filled in every data row.

    dim last_row as long
    ActiveSheet.Outline.Showlevels RowLevels:=2
    last_row = ActiveSheet.cells(rows.count,"A").end(xlup).row
    ActiveWorkbook.Worksheet("A-L").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("L2:L" & last_row), _
            SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("K2:K" & last_row), _
            SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("J2:J" & last_row), _
            SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("I2:I" & last_row), _
            SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("A-L").Sort.SortFields.Add Key:=Range("H2:H" & last_row), _
            SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("A-L").Sort
            .SetRange Range("A1:N" & last_row)
     '...
    If that's not enough, then probably my tool from the link above is not strong enough. And then I'll write basically the same as few posts above but in more open way:

    Will you please attach a SMALL sample Excel workbook(s) (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. (If trere are typical cases like: all unique values/duplicates could occur, day/night, nobody present/several persons at once, before/on/past due, etc. - please show them all or at least indicate in text) The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution(s) is/are also shown (mock up the results manually).

    3. Make sure that all confidential/restricted information (either personal or business) like real e-mails, social security numbers, bank accounts, etc. is removed first!!

    To attach an Excel file you have to do the following: Just before posting, scroll down and press Go Advanced button and then scroll down and press Manage Attachments link. Now follow the instructions at the top of that pop-up screen.
    Last edited by Kaper; 11-02-2018 at 04:00 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. need subtotal to also include the matching data in subtotal line
    By baby_kay_2003 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-15-2014, 12:43 AM
  2. adding IF statement to subtotal for autofiltered data
    By archedjumpshot in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-21-2013, 12:33 PM
  3. Replies: 1
    Last Post: 09-18-2013, 04:10 PM
  4. Replies: 8
    Last Post: 07-31-2012, 09:41 AM
  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. adding IF statement to subtotal for autofiltered data
    By fbarbie in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-07-2005, 03:00 PM
  7. [SOLVED] subtotal-isplaying data without using function subtotal ?
    By Marijan Glavaè in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-19-2005, 09:05 AM

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