+ Reply to Thread
Results 1 to 3 of 3

Sort two columns as one

  1. #1
    Registered User
    Join Date
    01-03-2016
    Location
    Serbia
    MS-Off Ver
    2007
    Posts
    25

    Sort two columns as one

    Hi,

    first - I have names in A column and dates in B column
    from A5:B10
    second - names in D column and dates in E column
    from D5:E30

    I can sort them independently and then copy upper of the second to the bottom of the first
    but I need to sort them as one, upper values of second columns to be
    appended on empty rows on A5:B10 (if any) and rest to be sorted in D5:E30

    is there a way to do this.

  2. #2
    Registered User
    Join Date
    01-03-2016
    Location
    Serbia
    MS-Off Ver
    2007
    Posts
    25

    Re: Sort two columns as one

    sort by dates
    B5:B10
    and
    E5:E30

  3. #3
    Registered User
    Join Date
    01-03-2016
    Location
    Serbia
    MS-Off Ver
    2007
    Posts
    25

    Re: Sort two columns as one

    Sub Macro4()
    '
    ' Macro4 Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+L
    '
    Application.Goto Reference:="godisnji12"
    Selection.Copy
    Range("K5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
    xlNone, SkipBlanks:=False, Transpose:=False
    Range("K5").Select
    Application.CutCopyMode = False
    Range("K5:L21").Select
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("L5:L21") _
    , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet1").Sort
    .SetRange Range("K5:L21")
    .Header = xlGuess
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Range("K5:L10").Select
    Selection.Copy
    Range("A5").Select
    ActiveSheet.Paste
    Range("K11:L21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("D5").Select
    Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
    , SkipBlanks:=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
    xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("D5").Select
    End Sub

+ 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] Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last colu
    By Andy15 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-09-2017, 05:35 PM
  2. Formula to sort columns instead of using the sort button
    By Hyflex in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-17-2016, 10:20 PM
  3. [SOLVED] Sort by multiple columns with sort criteria cell dependent
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-24-2014, 02:22 AM
  4. Replies: 2
    Last Post: 01-15-2014, 09:31 AM
  5. Replies: 5
    Last Post: 04-25-2013, 11:50 PM
  6. Sort Button that does not sort Balance Columns
    By hasancem in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2012, 10:31 AM
  7. data sort is not including all columns in sort
    By Tracy in forum Excel General
    Replies: 1
    Last Post: 10-03-2005, 08:05 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