+ Reply to Thread
Results 1 to 5 of 5

Sort multiple columns by one column until BLANK, then REPEAT

  1. #1
    Registered User
    Join Date
    01-22-2017
    Location
    newport beach, CA
    MS-Off Ver
    2013
    Posts
    4

    Exclamation Sort multiple columns by one column until BLANK, then REPEAT

    Hi,

    I have a sheet with multiple tables on the same worksheet 'Sheet1' separated by a blank row.

    I want the VBA to sort one by one.

    Considerations
    - Each table has different amount of rows
    - In the future, the columns amount will also change

    What will always be the same is:
    - The blank row between tables on column B, which is meant to be the starting point for excel to recognize there is a new table.
    - Each table will always be sorted by column C

    To give you a better picture, I am looking at consumer data cross tabs, where:

    COLUMN A = QUESTION TYPE
    COLUMN B = ANSWER CHOICES
    COLUMN C = Header is "TOTAL", and it contains % per answer choices

    The rest of COLUMS follow % like C but with different headers = like "male" "female" "user" "non user" "Age 18-25" "Age 26-34"....etc.

    I want to create a looped macro that will sort each table (and all the columns within the table) by Column C in ascending order identifying that it has to search for the next blank space and the table will be below it.

    Can someone help me out? I've tried looking at Looping, Sorting, and finding the next empty cell. But I can't put the pieces together for some reason.

    _____

    For ref: This one is the closest example and macro i've found to what im going for, but it doesn't apply to my scenario / couldn't make it work:

    http://stackoverflow.com/questions/3...ws-then-repeat
    Last edited by Tamichan5; 01-22-2017 at 09:05 PM.

  2. #2
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,204

    Re: Sort multiple columns by one column until BLANK, then REPEAT

    Perhaps something like

    Please Login or Register  to view this content.
    If that doesn't work, could you attach a workbook with a representative example of your lay-out, and the desired result?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    01-22-2017
    Location
    newport beach, CA
    MS-Off Ver
    2013
    Posts
    4

    Re: Sort multiple columns by one column until BLANK, then REPEAT

    Prior to Macro.png

    That would be an example of how the file looks like

  4. #4
    Registered User
    Join Date
    01-22-2017
    Location
    newport beach, CA
    MS-Off Ver
    2013
    Posts
    4

    Re: Sort multiple columns by one column until BLANK, then REPEAT

    Post macro.png

    This is how id like it to look (ignore the black border around each table) - the point is the sorting within each table in descending order of column C

  5. #5
    Registered User
    Join Date
    01-22-2017
    Location
    newport beach, CA
    MS-Off Ver
    2013
    Posts
    4

    Re: Sort multiple columns by one column until BLANK, then REPEAT

    Added some code for ref and two screenshots on the data...hope it helps, what do you think?

+ 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. sort data base on one column to multiple columns
    By typerxtreme in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-24-2013, 11:39 AM
  2. Sort multiple columns to one column, skip blanks
    By AlexCoyne in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-20-2013, 03:13 PM
  3. sum bold cells in a column...repeat across multiple columns
    By techguy24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2013, 11:02 AM
  4. [SOLVED] Sort multiple columns based on column header
    By Langer101 in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 01-09-2013, 09:55 AM
  5. [SOLVED] Sort by the multiple of 2 columns without making another column?
    By niko79542 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2012, 09:46 AM
  6. Sum Column Until Blank - Then Repeat
    By grantsweitzer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2011, 02:24 PM
  7. Replies: 1
    Last Post: 12-20-2010, 06:30 PM

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