+ Reply to Thread
Results 1 to 7 of 7

Sort rows based on two columns and leave blank row between them

  1. #1
    Registered User
    Join Date
    07-23-2014
    Location
    nicosia,cyprus
    MS-Off Ver
    MS Office 13
    Posts
    4

    Sort rows based on two columns and leave blank row between them

    Hello everyone,

    I wanted to ask something , I am trying to create a macro that sorts rows based on value of 2 columns, but every time that a value changes in either of them to leave an empty row between them.
    Is that possible? In simple words i want to separate my rows with the empty row while sorting them out alphabetically based on two columns.

    Please check my screen shots. Test 1 is my spreadsheet before the macro. Test 2 is how i need it to be after the macro. The two columns that i want it sorted out is First GDS then Rate.

    Thanks in Advance.

    Kind regards, Andriano
    Attached Images Attached Images

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Sort rows based on two columns and leave blank row between them

    It would be great if you provide sample workbook , its make easy to resolve query.
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Sort rows based on two columns and leave blank row between them

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-23-2014
    Location
    nicosia,cyprus
    MS-Off Ver
    MS Office 13
    Posts
    4

    Re: Sort rows based on two columns and leave blank row between them

    Thanks a lot Kalak for your answer! Let me ask one more thing i just added couple of columns is it possible to sort them out correctly because for some reason when it is sorting those column values are wrong?

    Regards Andrianos

  5. #5
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Sort rows based on two columns and leave blank row between them

    @Andrianos,

    You should provide a sample file since your verbal description gives too little information about just what you want.

    where on the worksheet did you add columns and in what way is the sorting of them and any others (if so which ones?) 'wrong'?

  6. #6
    Registered User
    Join Date
    07-23-2014
    Location
    nicosia,cyprus
    MS-Off Ver
    MS Office 13
    Posts
    4

    Re: Sort rows based on two columns and leave blank row between them

    Yes sorry for that i dont know how to put the workbook in forum so he are some images like before . We have test 3 and want it to become test 4 .

    I tried the code you posted but the column nights and total revenue their values are wrong when it sorts them based again on GDS and Rate.

    Thanks

    Regards Andrianos
    test 3.jpg
    test4.jpg

  7. #7
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Sort rows based on two columns and leave blank row between them

    @Andrianos

    You can try the modified code below to see how it works for you.

    Regarding attaching files, this makes a good response much more likely, since it's then easy to test any codes and in fact to ascertain more accurately just what the problem is.

    To attach files, look at the 'Additional Options' under the 'Your message' box when you are making a reply. 'Manage Attachments' is in the second item. It's really quite easy to do.
    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. Replies: 1
    Last Post: 05-19-2011, 09:53 AM
  2. Can't Sort rows based on Dates in 3 columns
    By bjwade62 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2010, 10:48 AM
  3. Combine rows based on blank columns
    By motomoto1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2010, 10:12 AM
  4. Sort specific rows and leave headers
    By sp1ken in forum Excel General
    Replies: 2
    Last Post: 05-12-2009, 10:29 AM
  5. Hide Blank Rows based on 2 columns
    By yzer19 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-06-2008, 11:23 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