(probably) a simple sorting question
Results 1 to 4 of 4

Thread: (probably) a simple sorting question
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2009
    Posts
    35
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default (probably) a simple sorting question

    Hi all,

    I think this is probably quite simple, but google searches are bringing up something slightly different to what I want.

    I have an accounts sheet, columns A-C are income, E-G are outgoings. I want to sort income by date, which is column A, and the outgoing by date, which is column E. When I try and filter this in excel, it gives me an error message saying "The command you chose cannot be performed on multiple selections.

    Is there an easy way to do this?

    Thanks,
    Dom

  2. #2
    Board Regular Logit's Avatar
    Join Date
    Aug 2016
    Location
    United States
    Posts
    2,728
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    1 Thread(s)

    Default Re: (probably) a simple sorting question

    .
    Here are two small macros :'

    Code:
    Option Explicit
    
    
    Sub srt()
    Sheet2.Range("A1").CurrentRegion.Sort key1:=Range("A1:C20"), Header:=xlYes
    End Sub
    
    
    Sub srt2()
    Sheet2.Range("E1").CurrentRegion.Sort key1:=Range("E1:G20"), Header:=xlYes
    End Sub

  3. #3
    Board Regular
    Join Date
    Feb 2012
    Location
    Florida, USA
    Posts
    10,993
    Post Thanks / Like
    Mentioned
    25 Post(s)
    Tagged
    2 Thread(s)

    Default Re: (probably) a simple sorting question

    Probably only use sort and do once for each three columns of data.
    example:
    Code:
    Dim lastRow As Long
    lastRow = Cells(Rows.Count, 1).End(xlUp).Row
    Range("A1:C" & lastRow).Sort Range("A1"), xlAscending, Header:=xlYes
    Range("E1:G" & lastRow).Sort Range("E1"), xlAscending, Header:=xlYes
    Using Windows 10, Excel 2013.
    Any code provided by me should be tested on a copy or a mock-up of your file before applying it to your original file. Some actions generated by VBA code cannot be reversed with the undo facility in Excel. To open the VB editor, press Alt + F11. To run code from the Excel window, press Alt + F8. Please do not attempt to learn everything about VBA in one thread, especially from me. See this link for attaching images: Attachments

  4. #4
    MrExcel MVP mikerickson's Avatar
    Join Date
    Jan 2007
    Location
    Davis CA
    Posts
    22,519
    Post Thanks / Like
    Mentioned
    20 Post(s)
    Tagged
    15 Thread(s)

    Default Re: (probably) a simple sorting question

    Quote Originally Posted by DrPips View Post
    ...
    I want to sort income by date, which is column A, and the outgoing by date, which is column E. When I try and filter this in excel, it gives me an error message saying "The command you chose cannot be performed on multiple selections.
    ...
    Filtering and sorting are different. If you want one, don't do the other.

    If you are sorting, you need to sort an entire continuous region. All columns and all rows in that region will be effected by the sort.
    Last edited by mikerickson; Aug 18th, 2019 at 06:11 PM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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