LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Sorting Multiple Columns in a single operation?

The following does 4 columns and assumes the same number of rows in
each column. You can easily modify it to suit.

Sub Macro1()
Dim iEnd As Integer
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
iEnd = ws.Range("A1").End(xlDown).Row
For iCol = 1 To 4
ws.Range(Cells(1, iCol), Cells(iEnd, iCol)).Sort Key1:=Cells(2,
iCol), _
Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Next iCol
End Sub

Hth,
Merjet


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple columns into single row Mr. R Excel Discussion (Misc queries) 3 January 12th 10 11:32 PM
move multiple columns into single set of columns mrg9999 Excel Discussion (Misc queries) 1 September 25th 07 05:08 AM
removing single quotes from a paste operation joeycalisay Excel Programming 7 February 9th 07 02:39 AM
SUMIF with multiple criteria for multiple columns to sum a single SavageMind Excel Programming 1 July 27th 05 03:34 PM
How do I lock columns together in a single row for sorting purpos. S.J.Michael Excel Discussion (Misc queries) 1 April 26th 05 02:18 AM


All times are GMT +1. The time now is 11:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"