Thread: [Solved] Macro to sort columns
View Single Post
 
Old 09-02-2016, 06:20 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2010 32bit
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Code:
Sub blah()
With ActiveWorkbook.Worksheets("SortIt")
  For colm = 1 To 340
    .Cells(1, colm).Resize(16).Sort .Cells(1, colm)
  Next colm
End With
End Sub
The above code assumes:
340 columns starting at column A
Sort range in each column is from row 1 to 16. (If your range is from row 3 to 10 then change to:
.Cells(3, colm).Resize(8).Sort .Cells(1, colm)
You do NOT need to change the second 1.
There are no headers in each column.
An ascending sort is required.

The above are the defaults - it is very easy to include/tweak these. Come back if necessary.
Reply With Quote