Sort multiple columns on sheet into A-Z

surkdidat

Well-known Member
Joined
Oct 1, 2011
Messages
582
Office Version
  1. 365
Hi

I have headers in Row 1, and pairs of data in columns (A&B, C&D, E&F all the way to FSS&FST). (Data from Row 4 to Row 1000 - not all rows will go down to row 1000, some will only ave one match, some will have 100, some could have 500 etc)

The data starts in row 4.

What I need it to do is sort the columns in alphabetical order, retaining the pair value for all 2285 pairs.

PRESENT DATA
Column A Column B Column CColumn D
Row 1COLOUR-ENGCOLOUR-FRSHAPE-ENGSHAPE-FR
Row 2(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)
Row 3(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)
Row 4 (Beginning of data)BlueBleuRoundArrondi
Row 5YellowJauneSquareCarré
Row 6RedRougeArchArc
Row 7GreenVertPyramidPyramide


RESULT

Column AColumn BColumn CColumn D
Row 1COLOUR-ENGCOLOUR-FRSHAPE-ENGSHAPE-FR
Row 2(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)
Row 3(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)(DATA HELD HERE - NOT TO BE MOVED)
Row 4BlueBleuArchArc
Row 5GreenVertPyramidPyramide
Row 6RedRougeRoundArrondi
Row 7YellowJauneSquareCarré
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try this:
VBA Code:
Sub SortData()
    Dim col As Long
    Dim dataRange As Range
    Dim sortRange As Range
    
    Set dataRange = Range("A1").CurrentRegion
    For col = 1 To dataRange.Columns.Count Step 2
        Set sortRange = Range(Cells(4, col), Cells(Rows.Count, col).End(xlUp))
        ActiveSheet.Sort.SortFields.Clear
        ActiveSheet.Sort.SortFields.Add2 Key:=sortRange, _
            SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveSheet.Sort
            .SetRange sortRange.Resize(sortRange.Rows.Count, 2)
            .Header = False
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    Next
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,220
Messages
6,123,693
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top