Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 09-02-2016, 06:20 AM
p45cal's Avatar
p45cal p45cal is offline Macro to sort columns Windows 10 Macro to sort columns 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
 

Tags
macro, sorting columns



Similar Threads
Thread Thread Starter Forum Replies Last Post
.pdf to .xlsx - How to get sort-able columns? CCinPA Excel 0 07-05-2016 08:30 AM
Macro to sort columns Normal sort not bringing along other columns Dave Fraser Excel 2 06-06-2014 11:48 AM
Need help sorting data in columns that will sort by number of Xs brenna.at.work Excel 8 04-12-2014 07:00 AM
quick replace, sort, change columns userman Excel 1 05-01-2012 06:24 AM
Macro to sort columns How to sort table having three columns? Bahir Barak Word 2 01-20-2011 01:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft