+ Reply to Thread
Results 1 to 4 of 4

Sorting Column with a variable range

  1. #1
    Registered User
    Join Date
    03-21-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    90

    Sorting Column with a variable range

    I am running into a problem with a worksheet that data changes constantly as more projects are added or deleted. I'm have to button that I want to sort the Project Number for each type or the Variance for each project type column in ascending order.

    The worksheet will be subtotaled for each project project type and I want to sort with keeping the project types from moving all over the worksheet.

    Also, I know how to insert a line for every time (in this case the Type column changes) but I want to automate the subtotaling also rather than running the code to insert the line and then having to go in and sum each of the columns. I have another tab called Before Subtotaled if anyone can help out there.

    Please view the attached file. You will see the code in the file.
    Attached Files Attached Files
    Last edited by jadown; 12-12-2013 at 03:28 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    Sunderland, England
    MS-Off Ver
    Excel 2007 (Home) / 2003 (Work)
    Posts
    740

    Re: Sorting Column with a variable range

    Easy fix for the subtotaling:

    =SUMIF(A:A,"Z",D:D)

    Replacing the Z with the Type for each subtotal line.

    Don't have time to look at code right now though, sadly.

  3. #3
    Registered User
    Join Date
    03-21-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    90

    Re: Sorting Column with a variable range

    Here is my code to sort but it only sorts by the activecell
    Please Login or Register  to view this content.
    Here is my code to insert a line below each change in the 'Type' column

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-21-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    90

    Re: Sorting Column with a variable range

    Ok I found this code to add the subtotal. Which works fine. I guess I can figure out rest but to subtotal more than one column. How do I change TotalList:=Array(5)? I tried TotalList:=Array(5,6,7) but that didn't work.

    Here is the code for the subtotaling.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sorting variable range left to right
    By shinobi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-16-2013, 05:04 AM
  2. Sorting a range to invert it upside down without sorting by any specific column
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2013, 12:53 PM
  3. [SOLVED] Sorting a range to invert it upside down without sorting by any specific column
    By luv2glyd in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-28-2013, 12:43 PM
  4. sorting changes the value of range-variable
    By HarryKlein in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2012, 06:55 AM
  5. Sorting by variable column
    By henboffman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-07-2011, 11:48 AM

Tags for this Thread

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